DBCP has the requested feature. It is not included in v1.0 so you need a nightly build.
The parameters you are looking for are:
(A) timeBetweenEvictionRunsMillis: The number of milliseconds to sleep between runs of the idle object evictor thread.
(B) numTestsPerEvictionRun: The number of objects to examine during each run of the idle object evictor thread (if any).
(C) minEvictableIdleTimeMillis : The minimum amount of time an object may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any).
Every "A" milliseconds, "B" idle connections are tested, if they are idle for more then "C" milliseconds then they will be removed from the pool
Typical values are: (A) timeBetweenEvictionRunsMillis: 60000 (default is disabled) (B) numTestsPerEvictionRun: 3 (=default) (C) minEvictableIdleTimeMillis : 1800000 (=1000 * 60 * 30) (=default)
Regards, Dirk
Keates, Mark wrote:
Hi,
I'm using pooling within a Servlet (under Tomcat) against Oracle with 'maxIdle=3' and 'maxActive=4' settings. I do see the 4 connections drop down to 3 but the remaining connections persist against the database. Does anyone have a method by which these will disconnect if the connection is idle for a given time, i.e. no activity? If this is done on the Oracle side, then it can't be global, i.e. affect other users.
Regards,
Mark
<Resource name="jdbc/TestServlet" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/TestServlet"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>username</name> <value>xxx</value> </parameter> <parameter> <name>password</name> <value>yyy</value> </parameter> <parameter> <name>driverClassName</name> <value>oracle.jdbc.driver.OracleDriver</value> </parameter> <parameter> <name>url</name> <value>jdbc:oracle:thin:@host:port:instance</value> </parameter> <parameter> <name>validationQuery</name> <value>SELECT 1 FROM DUAL</value> </parameter> <parameter> <name>maxActive</name> <value>4</value> </parameter> <parameter> <name>maxIdle</name> <value>3</value> </parameter> <parameter> <name>maxWait</name> <value>30000</value> </parameter> <parameter> <name>removeAbandoned</name> <value>true</value> </parameter> <parameter> <name>logAbandoned</name> <value>true</value> </parameter> <parameter> <name>removeAbandonedTimeout</name> <value>120</value> </parameter> </ResourceParams>
********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.
**********************************************************************
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
