wood burning stoves 2.0*
The moose likes JDBC and the fly likes Firewall timing out connections in Pool - Commons DBCP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Firewall timing out connections in Pool - Commons DBCP" Watch "Firewall timing out connections in Pool - Commons DBCP" New topic
Author

Firewall timing out connections in Pool - Commons DBCP

O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

I am using the Commons DBCP connection pool to manage my connections. Everything works fine but recently i found out that every morning i try to make a request, the application takes at least 9 minutes to process the request. Subsequent requests take just seconds.

I have tried to trace this and found out that since i set the connection pool to keep at least two connections alive, the next day i try to make a connection these two connections are reused. The problem is there is a firewall which resets every connection after every hour.

So the problem is the firewall is invalidating the connections and its taking my application too long to find out that a connection has been reset before it creates a new one.

I could try and re-write the DBCP connection pool to send "keep alives" but i dont think this is wise as how will i know which connection to send the keep alive for?

Does anyone have any idea how i can solve this? Or is there a setting on DBCP that will do this for me?

Here are my default values on the pool
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
We had a similar problem, so we set life time for a connection to 30 minutes. However we use a home made pool. I noticed that WL connection pool gives the same level of control, even better. So check documentation for your connection pool, it's common problem and should be covered by settings.


Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Firewall timing out connections in Pool - Commons DBCP
 
Similar Threads
Apache commons dbcp - SocketException: Too many open files
understanding keepAliveTimeout timeout
OutOfMemoryError from tomcat 5
how to use JDBC Connection Pools in a standalone application?
Database "process" breaks between two Tomcat versions