Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection Issue

 
arum mugam
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic