db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David W. Van Couvering" <David.Vancouver...@Sun.COM>
Subject Re: How does an application get access to JDBC implementation classes
Date Tue, 22 Nov 2005 05:25:06 GMT
Thanks, Dan.  Can you point me to something that talks more about what 
it means to be a "valid OSGi bundle?"

Lance, do you have any information on how a driver is loaded in JDBC4 
using the service provider mechanism?

Thanks,

David

Daniel John Debrunner wrote:
> 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.
> 
> Dan.
> 
> 

Mime
View raw message