commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vivian Fonger" <>
Subject RE: [DBCP] Problem: Connection closes prematurely
Date Tue, 02 Sep 2003 13:58:21 GMT
Hi everyone,

I cannot find the configuration setting - "removeAbandoned" or
"removeAbandonedTimeout".  I have configured the following parameters in


I cannot find anything regarding removeAbandoned or
removedAbandonedTimeout.  My application is using commons-pool version
1.1 distributed at 2002/05/04.  This is the error the application
trapped when the application is trying to traverse the next record in
the ResultSet:

java.sql.SQLException: Connection is closed.





        at java.util.TimerThread.mainLoop(


If anyone can give me some pointers on this problem, I will really
appreciate it.  Thanks

Vivian Fonger

Vivian Fonger
Software Engineer

-----Original Message-----
From: Dirk Verbeeck [] 
Sent: Sunday, August 31, 2003 7:31 AM
To: Jakarta Commons Users List
Subject: Re: [DBCP] Problem: Connection closes prematurely

A connection is considered active when it is borrowed from the pool by 
The connections in the pool are idle.

maxIdle & maxActive are both caps on the number of objects idle /
active. If you try to return a connection to the pool (by calling
close()) and 
the maxIdle limit is reached then the connection will be destroyed and 
not be added to the pool.

If you have enabled "removeAbandoned" then it is possible that a 
connection is reclaimed by the pool because it is considered to be 
This mechanism is triggered when (getNumIdle() < 2) && (getNumActive() >

getMaxActive() - 3)
For example maxActive=20 and 18 active connections and 1 idle connection

would trigger the "removeAbandoned".
But only the active connections that aren't used for more then 
"removeAbandonedTimeout" seconds are removed,
default (300 sec). Traversing a resultset doesn't count as being used.

If your traversal takes more then 300 sec then you can either disable 
the "removeAbandoned" or increase the "removeAbandonedTimeout".

But you are probably doing some processing while traversing the
resultset. If it takes so much time, then it's better to copy the
resultset data 
first into an array, close the connection and then do the processing.

If you need more help, please include version numbers, full 
configuration parameters and maybe a stacktrace.

Hope this helps

Vivian Fonger wrote:

>Hi everyone,
>I want to know what connection is considered active and what connection

>is considered idle.  Currently, my application is using DBCP connection

>pooling and I am having problem with connection closes premarturely. 
>This happen when the application is trying to traverse a resultset and 
>the application is extremely busy (i.e. a lot of threads are requesting

>database connectivities to perform database actions).  I have set the 
>maximum number idle connections pretty low, I am just wondering will 
>that be a cause of database connection closing prematurely when the 
>application is still traversing a resultset.
>Vivian Fonger

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message