File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DBCP issue

 
Wim Folkerts
Greenhorn
Posts: 19
Java jQuery Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1951
7
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Wim Folkerts
Greenhorn
Posts: 19
Java jQuery Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
Java jQuery Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic