According to what Sun says about jdbc4 in java 6, the line Class.forName("com.mysql.jdbc.Driver"); is not needed
http://www.onjava.com/pub/a/onjava/2006/08/02/jjdbc-4-enhancements-in-java-se-6.html
But I can't make it to work, has anybody tested Connector/J 5.1.5 with Java 1.6 without it ?
String connectionString = "jdbc:mysql://localhost/db1";
String dbUser = "root";
String dbPassword = "password";
//Class.forName("com.mysql.jdbc.Driver");
java.sql.Connection conn = DriverManager.getConnection(connectionString, dbUser, dbPassword);
The above code throws Exception No suitable driver found for jdbc:mysql://localhost/db1
I have the mysql-connector-java-5.1.5-bin.jar in Classpath beacuse when I uncomment the line Class.forName("com.mysql.jdbc.Driver"); everything works fine.