db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: How does an application get access to JDBC implementation classes
Date Tue, 22 Nov 2005 04:34:25 GMT
David W. Van Couvering wrote:
> OK, I think I may have the answer to my question.  Looking at the JDBC
> API, here is what I can figure out.  There are the following Connection
> factories that a JDBC implementation must provide:
> Driver
> DataSource
> XADataSource
> ConnectionPoolDataSource
> Next question:
> How do the instances of these get created?  

In addition to the other ways already discussed, JDBC 4.0 is adding the
automatic registration of JDBC drivers using the "Java Standard Edition
Service Provider mechanism". Thus in JDBC 4.0, this is valid JDBC code.

public static void main(String[] args)
   // no need to load a driver
   Connection conn = DriverManager.getConnection("jdbc:derby:cs");

This may have an impact on those looking at class loaders to support
multiple Derby drivers. I didn't find (in a very quick look) any
information on Java SE Service Provider, and how it handles class loading.

Also derby.jar is a valid OSGi bundle, this may also have some impact on
those looking at class loaders for multiple multi-version derby instances.

And, in fact the code above is valid in JDBC 2.0 and 3.0. If the driver
class name is in the system property "jdbc.drivers", then it will be
loaded automatically. Again I haven't looked to see how this handles
class loaders.


View raw message