This week's book giveaways are in the iOS and Features new in Java 8 forums.
We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and Relational Databases and the fly likes DBCP issue - Timeout waiting for idle object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "DBCP issue - Timeout waiting for idle object" Watch "DBCP issue - Timeout waiting for idle object" New topic

DBCP issue - Timeout waiting for idle object

Wim Folkerts

Joined: Mar 10, 2010
Posts: 19

Hello all,

We have been migrated a couple of months ago to the DBCP (Apache's Database Connectiong Pooling) setup for creating database connections ( We had a long period of testing in order to be sure the change in configuration would work. This week we've implemented the DBCP migration and the first errors came...

1. First of all we did not specify the maxWait attribute (default indefinitely) and then after 5 hours running the application just freezes.

2. So based on the topic "Intermittent dB Connection Failures" on the site we changed it to maxWait="15000". However then we got the below error after about 3 hours:
java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(
at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(

I've defined the JDBC resource in my <TOMCAT_6_HOME>\conf\context.xml as below:

Upon looking at the "Tomcat Web Application Manager" at about 15 session are active daily, so that is not a high workload for the DBCP configuration. Also connections are closed in the finally clause.

Can anyone advice how to overcome the above described errors?

Thanks in advance

It is sorta covered in the JavaRanch Style Guide.
subject: DBCP issue - Timeout waiting for idle object