db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lance J. Andersen" <Lance.Ander...@Sun.COM>
Subject Re: Autoloading of JDBC drivers considered harmful?
Date Tue, 30 May 2006 14:55:17 GMT


Daniel John Debrunner wrote:
> Knut Anders Hatlen wrote:
>
>   
>> Another issue with Derby and autoloading is that it only happens once
>> per JVM. If you do a getConnection("jdbc:derby:;shutdown=true"), the
>> driver is unloaded and won't be reloaded unless you do a
>> Class.forName(). So this code
>>
>>   Connection c = DriverManager.getConnection("jdbc:derby:mydb");
>>   doSomethingWithConnection(c);
>>   try {
>>     DriverManager.getConnection("jdbc:derby:;shutdown=true");
>>   } catch (SQLException) { /* shutdown exception */ }
>>
>> runs fine the first time it is executed, but if it is executed later
>> within the same JVM, it fails with "no suitable driver".
>>     
>
> Is this special to Derby, or is it true for any JDBC driver?
>
> Do other drivers provide the ability to de-register themselves from the
> DriverManager? Or can an application just call?
>
> DriverManager.deregisterDriver(DriverManager.getDriver(url));
>   
this is a public method, like anything on DriverManager, but this is not 
a method normally used by developers of JDBC applications.
> Dan.
>
>
>
>   

Mime
View raw message