You can set the mysql connection to JSP by using one of the method given below :
The URL based mysql connection is
jdbc:mysql://serverip address/DATABASENAME?user=USERNAME&password=PASSWORD
OR
< !– Database connection settings –>
com.mysql.jdbc.Driver jdbc:mysql://localhost/database_name databses_user password < !– configuration pool via c3p0–>
OR
try {
Class.forName(“com.mysql.jdbc.Driver”).newInstance();
// here we are connecting to localhost, port 3306. Change it to your db server address:port
con = DriverManager.getConnection(“jdbc:mysql://localhost:3306/databaseName”,
“root”, “secret”);
//or con = DriverManager.getConnection(“jdbc:mysql://localhost:3306/databaseName?user=
root&password=secret”;
}
catch(Exception e){
System.out.println(e.getMessage());
}
That’s all.

