java.sql.DriverManager

来源:互联网 发布:香哈软件 编辑:程序博客网 时间:2024/04/28 18:13

Applications no longer need to explictly load JDBC drivers using Class.forName(). Existing programs which currently load JDBC drivers using Class.forName() will continue to work without modification.

 

When the method getConnection is called,the DriverManager will attempt to locate a suitable driver from amongst those loaded at initialization and those loaded explicitly using the same classloader as the current applet or application.

 

The "public static Connection getConnection()" method will invoke "private static Connection getConnection(String url, java.util.Properties info, ClassLoader callerCL) throws SQLException",and then finally invoke "private static void loadInitialDrivers()" to implement JDBC driver loading.

 

sourcecode:

 

so when "getConnection()" over loading method has been invoked in Applications, the JDBC dirver would be loaded!

原创粉丝点击