Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 64061 invoked from network); 2 Mar 2011 14:29:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Mar 2011 14:29:04 -0000 Received: (qmail 61483 invoked by uid 500); 2 Mar 2011 14:29:04 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 61339 invoked by uid 500); 2 Mar 2011 14:29:02 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 61323 invoked by uid 99); 2 Mar 2011 14:29:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Mar 2011 14:29:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Mar 2011 14:28:58 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 0FCE14BFEA for ; Wed, 2 Mar 2011 14:28:37 +0000 (UTC) Date: Wed, 2 Mar 2011 14:28:37 +0000 (UTC) From: "Rick Hillegas (JIRA)" To: derby-dev@db.apache.org Message-ID: <1077708658.7902.1299076117061.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1520412007.18831.1297805577688.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] Commented: (DERBY-5043) Document the new url attribute deregister to keep the AutoloadedDriver registers in DriverManager MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-5043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13001432#comment-13001432 ] Rick Hillegas commented on DERBY-5043: -------------------------------------- > 2) Is this attribute valid only when using JDBC 4.0 or 4.1? (Driver autoloading is present with JDBC 4.0 but not with 3.0.) The attribute works if you are running on JDK 1.4 (i.e. JDBC 3.0). I don't think it is helpful to discuss this attribute in terms of autoloading. (In any event, driver autoloading was introduced by JDBC 3.0 although Derby didn't get around to supporting it until release 10.2.) I think it would be better to frame the discussion in terms of the following user-visible behaviors: 1) Driver (de)registration. 2) Orderly shutdown. 3) Garbage-collection of Derby classes. There are several ways that the embedded driver can be registered: i) By invoking Class.forName( "org.apache.derby.jdbc.EmbeddedDriver" ). This mechanism works on all JVMs from JDK 1.4 on up. ii) By setting -Djdbc.drivers=org.apache.derby.jdbc.EmbeddedDriver when booting the engine's VM and then by calling DriverManager.getConnection(). This mechanism also works on all JVMs from JDK 1.4 on up. It is the original version of driver autoloading. iii) By simply calling DriverManager.getConnection(). This is the additional autoloading mechanism which was introduced by JDBC 4.0. This scenario only works on Java 6 on up. Once the embedded driver is registered, you can shutdown the Derby engine by using the special shutdown URL. If you specify deregister=true at the end of that URL, then you will see the following behavior: a) The embedded driver will remain registered. b) The Derby classes will NOT be garbage-collected. c) You can get a Derby connection just by issuing a DriverManager.getConnection() call. That is, you DON'T need to first invoke Class.forName( "org.apache.derby.jdbc.EmbeddedDriver" ).newInstance(). In contrast, if you DON'T specify deregister=true on the shutdown URL, then you will see the opposite behavior: a) The embedded driver will be deregistered. b) The Derby classes will (probably, eventually) be garbage-collected. c) You will have to invoke Class.forName( "org.apache.derby.jdbc.EmbeddedDriver" ).newInstance(). before obtaining a new Derby connection. Hope this helps, -Rick > Document the new url attribute deregister to keep the AutoloadedDriver registers in DriverManager > ------------------------------------------------------------------------------------------------- > > Key: DERBY-5043 > URL: https://issues.apache.org/jira/browse/DERBY-5043 > Project: Derby > Issue Type: Improvement > Components: Documentation > Affects Versions: 10.7.1.1 > Reporter: Lily Wei > Assignee: Kim Haase > Labels: derby_triage10_8 > Fix For: 10.8.0.0 > > Attachments: Repro2905.java > > > With DERBY-2905, we have a new connection url attribute - deregister. After a shutdown of the embedded driver, the AutoloadedDriver is unregistered from the DriverManager. Users who wish to keep the AutoloadedDriver can set the deregister attribute on the connection url to false. It is only valid with shutdown=true. And, the default behavior with shutdown=true is deregister=true. > For example: > 'shutdown=true;deregister=true" (It is okay not to specify deregister=true) > 'shutdown=true;deregister=false" -- This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira