commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eickvonder Bjoern" <Eickvonder.Bjo...@inside-online.de>
Subject [DBCP] Datasource getConnection returns an already closed connection
Date Tue, 11 Dec 2007 13:15:46 GMT
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:

  <Resource name="jdbc/test" auth="Container"
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


Mime
View raw message