0
votes

What may be reason for tomcat does not release connections after using?

Herem is my config

<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"
/>
2
I get this error when try get connection from pool "Timeout: Pool empty. Unable to fetch a connection in 15 seconds, none available"user3569530
It would be helpful if you provide a small piece of code that when run alone causes the error to appear. If you do this, we can suggest specific information about what you can do to fix this problem.Rob

2 Answers

1
votes

You still need to call connection.close() in your code to have the connection released to the pool. It does not happen automatically.

You can configure the pool to detect "left over connections" wiht:

removeAbandoned="true"
removeAbandonedTimeout="60"

connection inactive for longer than given number of seconds will be closed automatically and recycled by the pool

0
votes

The most probable is that you don't close connections after using them. It can happens for example if you don't manage correctly exceptions.