We have a connection pool for an embedded derby database. We are setting
- max wait time to 5 secs
- max connection in pool 100
We are getting org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object very frequently. When this exception is coming, the connections owned by the application is always 1, this is evident from the logs.
The above exception states that the pool manager cannot produce a viable connection to a waiting requester and the maxWait has passed therefore triggering a timeout. Ref: Cannot get a connection, pool error Timeout waiting for idle object in PutSQL?
There is 1 application using derby, the Derby database, and 2 other applications.
As per my understanding, the following are the main reason for not getting a connection
- There is a network issue
- Connection pool has been exhausted, because of connection leak
- Connection pool getting exhausted, because of long-running queries
In our case, it's an embedded derby database which is local to the application. So, network issue is ruled out. There are no long-running queries. I am not able to figure out what is causing wait timeout. Could it be related to OS, Filesystem, server utilization going high etc?
Any help is appreciated.