tomcat使用后不释放连接可能是什么原因?
这里是我的配置
<Resource name="jdbc/DataSource" auth="Container"
type="javax.sql.DataSource" username="))" password="))"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="))"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
initialSize="55"
maxActive="55" maxIdle="55" maxWait="15000"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1 FROM DUAL"
validationInterval="20000"
timeBetweenEvictionRunsMillis="30000"
removeAbandoned="true"
removeAbandonedTimeout="60"
/>
最佳答案
您仍然需要在代码中调用 connection.close() 以将连接释放到池中。它不会自动发生。
您可以配置池以检测“剩余连接”:
removeAbandoned="true"
removeAbandonedTimeout="60"
连接不活动时间超过给定秒数将自动关闭并由池回收
关于java - tomcat jdbc连接池,使用后不释放连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29631626/