[ 
https://issues.apache.org/jira/browse/DERBY-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12981202#action_12981202
 ] 

Knut Anders Hatlen commented on DERBY-2905:
-------------------------------------------

Adding a deregister attribute to the URL when shutting down the system sounds 
like a good idea to me. I think true would be a reasonable default, as that 
would make the behaviour consistent with the documentation. I don't think that 
it would break the autoloading idiom any more than it already is in this case. 
If we do a getConnection() after a driver shutdown, without doing 
Class.forName(...).newInstance() in between, we get this exception with the 
current code:

Exception in thread "main" java.sql.SQLException: 
org.apache.derby.jdbc.EmbeddedDriver is not registered with the JDBC driver 
manager
        at 
org.apache.derby.jdbc.AutoloadedDriver.getDriverModule(AutoloadedDriver.java:186)
        at 
org.apache.derby.jdbc.AutoloadedDriver.connect(AutoloadedDriver.java:119)
        at java.sql.DriverManager.getConnection(DriverManager.java:620)
        at java.sql.DriverManager.getConnection(DriverManager.java:222)

If we make shutdown deregister AutoloadedDriver, we'd probably get a "No 
suitable driver" error instead, but I don't think that's any worse than what we 
have now.

> Shutting down embedded Derby does not remove all code, the AutoloadDriver is 
> left registered in the DriverManager.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2905
>                 URL: https://issues.apache.org/jira/browse/DERBY-2905
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.2.2.0, 10.3.1.4, 10.4.1.3
>            Reporter: Daniel John Debrunner
>            Assignee: Lily Wei
>         Attachments: DERBY-2905_1.diff, DERBY-2905v0.diff, DERBY-2905v0.stat, 
> DERBY-2905v1.diff, DERBY-2905v1.stat, DERBY-2905v3.diff, DERBY-2905v3.stat, 
> Main.java, Mainv1.java, Repro2905.java
>
>
> After a shutdown of the embedded driver the AutoloadDriver is not 
> unregistered from DriverManager. However it does not support any future 
> loading of connections so it has no value in remaining registered. Since the 
> DriverManager class will remain forever, this means the Derby code will 
> remain forever in the JVM, even if Derby was loaded by a separate class 
> loader.
> Regression from 10.1 since before the AutoloadedDriver the internal driver 
> did unregister itself from the DriverManager on a shutdown.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to