This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes Need help with a graceful failed database connection recovery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Need help with a graceful failed database connection recovery" Watch "Need help with a graceful failed database connection recovery" New topic
Author

Need help with a graceful failed database connection recovery

phil foster
Greenhorn

Joined: Dec 01, 2010
Posts: 2
I have a portal application that communicates with an Oracle database via a JDBC connection setup as a datasource in our WebSphere Application Server (v6.1) to make use of proper connection pooling. Due to circumstances that we can’t control the network link to the database is occasionally down (this is rare, and it has to do with our service provider that helps us communicate to the database that is overseas). When the connection is down it takes about 3 minutes for our application to realize it is down. What do I need to code, or change in the datasource, that will allow the application’s attempt to get the connection to timeout? If there hasn’t been a response in 10 seconds, then it is down and I want to display a nice message to the end user. I’ve tried changing several different parameters in the datasource setup but can’t find any that do what I need. Some settings I changed are:
Connection Timeout, Reap time,Unused Timeout, loginTimeout, Stuck timer time, Stuck time, Stuck threshold.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10426
    
    8

Phil,
Welcome to the Ranch.

I think your question would be more suitable for the JDBC forum. I will move it there for you.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Some settings I changed are:
Connection Timeout, Reap time,Unused Timeout, loginTimeout, Stuck timer time, Stuck time, Stuck threshold.


Have you chnaged these programatically inside your DBConnect class of your Application or with the help of server Datasource settings ??

Not sure whetehr works or not , but just a guess
Have you tried using

getLoginTimeout()
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database.


void setLoginTimeout(int seconds)
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.





Save India From Corruption - Anna Hazare.
phil foster
Greenhorn

Joined: Dec 01, 2010
Posts: 2
When I set the loginTimout property of my DataSource object in the code it does not change. When I print it out it is still zero. Setting the loginTimout property of the DataSource by configuring it on the server also does not work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help with a graceful failed database connection recovery