commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <dirk.verbe...@pandora.be>
Subject Re: [DBCP] abandoned connections problem
Date Sun, 26 Oct 2003 18:44:25 GMT
I have my own jsp page and it works for me :-)
Try it yourself:
    http://cvs.apache.org/viewcvs/jakarta-commons/dbcp/doc/

Be sure to use the following configuration:
     <Resource name="jdbc/abandoned" auth="Container" type="javax.sql.DataSource"/>
     <ResourceParams name="jdbc/abandoned">
       <parameter><name>username</name><value>sa</value></parameter>
       <parameter><name>password</name><value></value></parameter>
 
<parameter><name>driverClassName</name><value>org.hsqldb.jdbcDriver</value></parameter>
       <parameter><name>url</name><value>jdbc:hsqldb:database</value></parameter>

       <parameter><name>removeAbandoned</name><value>true</value></parameter>
       <parameter><name>removeAbandonedTimeout</name><value>0</value></parameter>
       <parameter><name>logAbandoned</name><value>true</value></parameter>

       <parameter><name>maxActive</name><value>1</value></parameter>
     </ResourceParams>


The conditions to activate the abandoned mechanism are:
    (getNumIdle() <  2) and (getNumActive() >  getMaxActive() - 3)


-- Dirk

Matthias Pekny wrote:

> I'm using dbcp in combination with tomcat 4.1.27.
> 
> According to the tomcat docs there is the possibility to let dbcp handle 
> abandoned connections. As I understand it this includes connections that 
> are opened by an web application but are never closed.
> 
> To verify this, I've created a jsp test page, that does exactly that. 
> Open several db connections, but doesn't close it. (The connections are 
> not used to access the db, they just get opened)
> 
> In the server.xml file there are entries that resemble those from the 
> docs example config in the context of the application:
> 
> <!-- handling of abandoned connections -->
> <parameter>
>     <name>removeAbandoned</name>
>     <value>true</value>
> </parameter>
> <!-- timeout in seconds -->
> <parameter>
>     <name>removeAbandonedTimeout</name>
>     <value>30</value>
> </parameter>
> <parameter>
>     <name>logAbandoned</name>
>     <value>true</value>
> </parameter>
> 
> 
> However the connections stay open and won't get closed.
> 
> It is, of course, not important to get the test page running, but the 
> behaviour is the same for an real application and this causes major 
> problems.
> 
> Yes, I know that it is important to close the connections and not let 
> tomcat handle this.
> 
> Any help with this is truly appreciated.




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message