• Register

How to connect JDBC & MySQL?

Recently I was working on a project where I needed to  connect JDBC & MySQL database. Can anyone help me in getting the complete tutorial or initial suggestions.
asked Aug 2, 2013 by Ashwini Kumar

1 Answer

0 votes

For the connection between java and mysql you have to use the "mysql-connector-java-5.07.jar" file as library
this library will provide the connection between java and mysql

The syntax for it ,
Class.forName("com.mysql.jdbc.Driver");
Connection conn = null;
conn = DriverManager.getConnection("jdbc:mysql://hostname:port/dbname","username", "password");

For more information see the link Click here

answered Aug 2, 2013 by Mahesh Nawale

Related questions

...