java.sql.DriverManager

穆毅然
2023-12-01

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!

 类似资料:

相关阅读

相关文章

相关问答