Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 85886 invoked from network); 10 Mar 2008 13:14:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Mar 2008 13:14:43 -0000 Received: (qmail 36921 invoked by uid 500); 10 Mar 2008 13:14:38 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 36900 invoked by uid 500); 10 Mar 2008 13:14:38 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 36889 invoked by uid 99); 10 Mar 2008 13:14:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Mar 2008 06:14:38 -0700 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [192.18.6.24] (HELO gmp-eb-inf-2.sun.com) (192.18.6.24) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Mar 2008 13:13:59 +0000 Received: from fe-emea-09.sun.com (gmp-eb-lb-2-fe2.eu.sun.com [192.18.6.11]) by gmp-eb-inf-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m2ADE8RA007418 for ; Mon, 10 Mar 2008 13:14:08 GMT Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JXI00J01MSG4U00@fe-emea-09.sun.com> (original mail from John.Embretsen@Sun.COM) for derby-user@db.apache.org; Mon, 10 Mar 2008 13:14:08 +0000 (GMT) Received: from [129.159.112.232] by fe-emea-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JXI00MXCNFG5A90@fe-emea-09.sun.com> for derby-user@db.apache.org; Mon, 10 Mar 2008 13:14:05 +0000 (GMT) Date: Mon, 10 Mar 2008 14:12:23 +0100 From: John Embretsen Subject: Re: Closig connection vs shutting down derby In-reply-to: <15950674.post@talk.nabble.com> Sender: John.Embretsen@Sun.COM To: Derby Discussion Reply-to: derby-user@db.apache.org Message-id: <47D533B7.5030303@Sun.COM> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT References: <15949672.post@talk.nabble.com> <5627810d0803092032w25e6a3bdq8e6df98cdd119373@mail.gmail.com> <15950674.post@talk.nabble.com> User-Agent: Thunderbird 2.0.0.12 (X11/20080228) X-Virus-Checked: Checked by ClamAV on apache.org musky wrote: > what about the case where derby is run as a network server? Just to make sure you are not making any invalid assumptions here: I think the DatabaseManager library Donald mentioned is the one described on the wiki at http://wiki.apache.org/db-derby/DatabaseManager. This is *not* part of Derby, and I cannot tell from the information on that page how or when the library shuts down databases. A Derby database will not be automatically shut down when closing all connections to it (assuming you are not using any external libraries such as the one mentioned above). The database may, however, be automatically shut down if you shut down the Network Server (I think this depends on how you do that, e.g. via the command line vs. in a Java program), or if you shut down the entire Derby system (connection URL "jdbc:derby:;shutdown=true"). Shutting down the database is not vital in order to preserve your data or anything like that, but it is recommended for a number of reasons, including: - letting other apps/processes boot the database without risking running into issues related to double-boooting (as Narayanan already mentioned) - if you don't shut down your database before exiting your application, Derby will automatically run recovery operations upon the next boot, thus making the startup slower. Shutting down using a JDBC URL always results in an SQLException being thrown. To see an example of how to handle that, see the SimpleApp demo inlcuded in the latest Derby release, or at http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/simple/SimpleApp.java?view=markup (search for "shutdown") regards, -- John > Donald McLean-3 wrote: >> The DatabaseManager library which run Derby in embedded mode just closes >> all >> of the connections and the database shuts itself down when the last >> connection is closed. >> >> Donald >> >> On Sun, Mar 9, 2008 at 9:16 PM, musky wrote: >> >>> I have a doubt: >>> >>> i an application after obtaining a connection to a database and after i >>> perform all required transactions on the tables of the database do i need >>> to >>> shutdown the database or is it enough if i just close the connection. >>> >>> i tried shutting down the database but i get the >>> nontransientconnectionexception sql state:08006