Class.forName not required with JDBC v.4
Starting with Java 6, Class.forName("something.jdbc.driver.YourFubarDriver")
is not necessary anymore if you use a recent (JDBC v.4) driver.
For detailsread this:http://onjava.com/pub/a/onjava/2006/08/02/jjdbc-4-enhancements-in-java-se-6.html
如果使用的是JDBC3则需要添加如下其中一条:
DriverManager.registerDriver(new com.mysql.jdbc.Driver ());
Class.forName("com.mysql.jdbc.Driver");