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