From user-return-20318-apmail-commons-user-archive=commons.apache.org@commons.apache.org Tue Dec 11 13:44:56 2007 Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 66717 invoked from network); 11 Dec 2007 13:44:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Dec 2007 13:44:56 -0000 Received: (qmail 87491 invoked by uid 500); 11 Dec 2007 13:44:41 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 87440 invoked by uid 500); 11 Dec 2007 13:44:41 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 87431 invoked by uid 99); 11 Dec 2007 13:44:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 05:44:41 -0800 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [130.132.232.16] (HELO hera.med.yale.edu) (130.132.232.16) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 13:44:42 +0000 Received: from moussaka.med.yale.edu (moussaka.med.yale.edu [128.36.29.108]) by email.med.yale.edu (PMDF V6.2-X17 #31441) with ESMTPS id <0JSW0XZAO0TWJF@email.med.yale.edu> for user@commons.apache.org; Tue, 11 Dec 2007 08:44:20 -0500 (EST) Date: Tue, 11 Dec 2007 08:44:20 -0500 From: Mark Shifman Subject: Re: [DBCP] Datasource getConnection returns an already closed connection In-reply-to: <6F52B85EF17DDE45AA3928FF7ECB748ACE857C@mail.inside.de> To: Jakarta Commons Users List Message-id: <475E9434.9050009@yale.edu> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit User-Agent: Thunderbird 2.0.0.6 (X11/20070728) References: <6F52B85EF17DDE45AA3928FF7ECB748ACE857C@mail.inside.de> X-Virus-Checked: Checked by ClamAV on apache.org Look at the bottom of this howto. the is a discussion of Random Connection Closed Exceptions and a remedy. http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html mas Eickvonder Bjoern wrote: > Hi, > > I've a problem with Tomcat 5.5.25 which uses DBCP 1.2.2 in the following > scenario: > > 1.) I've declared pooling in the context-file as follows: > > type="javax.sql.DataSource" > username="root" > password="root" > driverClassName="com.mysql.jdbc.Driver" > url="jdbc:mysql://localhost/test" > maxActive="2" > maxIdle="1" > minIdle="1" > maxWait="60000" > timeBetweenEvictionRunsMillis="300000" > minEvictableIdleTimeMillis="1800000" > /> > > 2.) Now I retrieve a connection twice via Datasource getConnection - > everything works fine. > 3.) Now the database closes the idle connection by either timeout or > server restart. > 4.) If I now try to retrieve a connection again I retrieve a closed > connection, leading to further exceptions. > > In Tomcat 5.5.23 using DBCP 1.2.1 step 4 returned a valid connection. > > Is this a bug or feature of DBCP 1.2.2? > > > Some background info: > The getConnection call in my application is done by JPOX 1.1.7 and and > adding some debug code into its source showed that at line 898 in > > http://jpox.cvs.sourceforge.net/jpox/JPOX/Core/src/java/org/jpox/store/r > dbms/adapter/DatabaseAdapter.java?hideattic=0&revision=1.111.2.2&view=ma > rkup > > the connection is valid/open for DBCP 1.2.1 and closed for DBCP 1.2.2 > concerning step 4. > > > Bjoern Eickvonder > > > PS: > Moreover I found out that calling close() on an already > closed-Connection (as in line 933 of the JPOX DatabaseAdapter) leads to > an SQLException using DBCP while the Java Api for java.sql.Connection > states that > "Calling the method close on a Connection object that is already closed > is a no-op."! Bug? > > > Kennen Sie schon die inside Schulungsma?nahme zur VVG-Reform? Erfahren Sie mehr dazu unter www.vvg-konzept.de. > > Besuchen Sie uns an unserem Stand C 8 auf der Learntec in Karlsruhe vom 29.-31.01.08. > > > Diese Mitteilung ist vertraulich und ausschlie?lich an den entsprechenden Empfanger gerichtet. Wenn Sie diese Mitteilung versehentlich erhalten haben, durfen Sie diese nicht kopieren, weitergeben oder in sonstiger Weise verbreiten. Bitte informieren Sie in einem solchen Fall den Absender und loschen Sie die Mitteilung sowie alle zugehorigen Anhange. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > > -- Mark Shifman MD. Ph.D. Yale Center for Medical Informatics Phone (203)737-5219 mark.shifman@yale.edu --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org