aspose file tools
The moose likes JDBC and the fly likes Invalid connection pool when database is down Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Invalid connection pool when database is down" Watch "Invalid connection pool when database is down" New topic
Author

Invalid connection pool when database is down

Jianhua Ren
Greenhorn

Joined: Oct 19, 2003
Posts: 26
I have a java thread, it will update the database every 15 minutes, only when the thread got started, it creates a connection pool to the database. But our database will be shut down during the weekend, after this, the connection pool contains unuseful connections. I have to restart the thread to recreate the connection pool. Does anybody got experience to handle this issue without restarting the thread?
I thought we could use catch block to catch exception, assuming I have 5 connections in the pool, so after I got 5 exceptions(each get connection method will throw one exception), I set up a static variable BAD_CONNECTION to true, then when next time, my thread runs, it will check the variable BAD_CONNECTION, if it's true, a new connection pool will be created. But what happens to the old connection pool? it will be automatically garbage collected? Say if database down for a long time, my thread will create a bunch of unuseful connection pools, since it runs every 15 minutes. Is there any memory leak here?
Any comments would be welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invalid connection pool when database is down
 
Similar Threads
Connection Pooling Help Needed
Refresh() method of oracleConnectionCacheManager!
getting errors while running duke's bank application
Query regarditng Connection Pooling
Maximum pool size for Database connection Pooling