For connecting java application with the mysql database, you need to follow 5 steps to perform database connectivity.
In this example we are using MySql as the database. So we need to know following informations for the mysql database:
Let's first create a table in the mysql database, but before creating table, we need to create database first.
In this example, sonoo is the database name, root is the username and password.
Download the mysqlconnector.jar file. Go to jre/lib/ext folder and paste the jar file here.
There are two ways to set the classpath:
open command prompt and write:
Go to environment variable then click on new tab. In variable name write classpath and in variable value paste the path to the mysqlconnector.jar file by appending mysqlconnector.jar;.; as C:\folder\mysql-connector-java-5.0.8-bin.jar;.;
Near fortis Hostipal