這在JNDI的文檔中是有敘述的:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
大體上說的就是在server.xml中的<ResourceParams>
中加入如下參數:
<!– To configure a DBCP DataSource so that abandoned dB connections are removed and recycled add the following paramater to the ResourceParams configuration for your DBCP DataSource Resource: –>
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<!–Use the removeAbandonedTimeout parameter to set the number of
seconds a dB connection has been idle before it is considered abandoned. –>
<parameter>
<name>removeAbandonedTimeout</name>
<value>60</value>
</parameter>