Java – how driver classes reside in JDBC 4

A good addition in version 4 of JDBC is that you don't have to load it explicitly

What's my problem? What if there are multiple drivers in the classpath?

I can guess that when parsing the connection URL, whether the driver needs JDBC or ODBC can be solved, but how to tell which of the multiple JDBC compliant drivers is for the database I am using? Let me say I'm using MySQL and I need the MySQL connector driver Is there such a static mapping of database drivers in the JVM?

Solution

Some information about JDBC 4 driver loading is taken from: http://www.onjava.com/2006/08/02/jjdbc-4-enhancements-in-java-se-6.html

org.apache.derby.jdbc.EmbeddedDriver

Now come to your question

As a class loader rule, any class found first will be loaded. If it has been loaded, it will not be reloaded by the class loader

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>