aspose file tools*
The moose likes JDBC and the fly likes Connection Issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection Issue" Watch "Connection Issue" New topic
Author

Connection Issue

arum mugam
Greenhorn

Joined: Nov 02, 2004
Posts: 1
We have an application which uses Oracle 8.1.7. We have connection pool which creates 5 connection on startup of the application.

Scenario 1:
Database server running. Tomcat server running. - Application works fine

Scenario 2:
Database server shutdown. Tomcat server running- Application Fails

Scenario 3:
Database server started. Tomcat server running - Application Fails

Scenario 4:
Database server running. Tomcat server restarted- Application works fine.

In the scenario 3, I want the application to run (ie., with out restarting the Tomcat server being restarted).

Can some one pls help?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

which database pooling are you using? You need one that detects stale connections and refreshes them. I'm not aware of one offhand, but I know they are out there. (The weblogic pool has been doing it for years)

Dave
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

Arum,
If you can't find a connection pool that deals with stale connections, you can handle this yourself.

The first time an application accesses the database, catch any SQLExceptions thrown and try again. Make sure to only try one more time in case the db really is down. This is easy to implement and very portable. Most drivers will realize the connection is stale after trying to use it and get you a new one the second time.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
Consider Paul's rocket mass heater.
 
subject: Connection Issue
 
Similar Threads
JDBC ODBC Connection
dynamic connection Pool Problem
connection error when running web aplication using Tomcat 6.0
Websphere Troubleshooting..
Auto-restart a web app on Tomcat for high availability