File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes DBCP issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "DBCP issue" Watch "DBCP issue" New topic
Author

DBCP issue

Wim Folkerts
Greenhorn

Joined: Mar 10, 2010
Posts: 19

Hello,

We've been migrated to the DBCP connection setup of Apache via JNDI lookup and use the connection setup like described on the site:
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html

The reason of this migration is because the existing OracleConnectionPoolDataSource object (oracle.jdbc.pool.OracleConnectionPoolDataSource) was not thread safe. See explanation on the site:
http://forums.sun.com/thread.jspa?threadID=288273&messageID=1135172&forumID=48

The DBCP implementation solved this problem, but now I facing the following issue; I run the webapplication without any problem. However the next day I suddenly have the following error:

After refresh:

After the next refresh:

When I refresh the site again, I got the web application back again.

We're using the following configuration:
- Tomcat 6.0.14
- JDK 1.6.0_14
- The ojdbc14.jar, ojdbc14dms.jar and orai18n.jar (from Oracle 10g) are in the %TOMCAT_HOME%/lib folder

Can anyone help me with this issue?

Regards Wim
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1761
    
    7

That problem could be related to idle connections being cleaned up.
DBCP should allow you to configure it to test and reallocate idle connections if necessary.

http://commons.apache.org/dbcp/configuration.html

Try playing around with the testOnBorrow / testOnReturn / testWhileIdle etc. properties and see if that solves the problem.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Wim Folkerts
Greenhorn

Joined: Mar 10, 2010
Posts: 19

Thanks Jelle, I'll look into those properties.

I configured the DBCP properties in that way that abandoned connections are removed and logged, see below:
Wim Folkerts
Greenhorn

Joined: Mar 10, 2010
Posts: 19

Hello,

I've just changed the DBCP configuration and after I wait a day, I didnt get the issue I previously had. Once in 30 minutes it checks for max 3 connections if it is still valid. If no, it will be removed from the pool which solves the stale connection problem. Below a part of this testOnBorrow config:

So it looks like this issue has been resolved!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DBCP issue