Posted comments (1)

Posted by Java Experience at December 24, 2012 15:40:34 UTC
I would like to add a point which Java beginners don't know:
We need to have driver class available in memory so that <a href="http://www.javaexperience.com/java-database-connectivity/">connection to database</a> can be created. The above code does good job of loading the driver by using the following code:
// Load the MySQL driver
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
// An alternative way
// Class.forName("com.mysql.jdbc.Driver").newInstance();