• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 890
  • Last Modified:

OracleConnectionCacheManager - Event Listener

Hi,

I have an Oracle 10g database and we are developping a 3-tier application. I am currently working on the database connection management (Connection Pooling) and would like to notify client applications when there is a problem with connecting to the database and then notify when connection is available again later.

At first, I used OracleDataSource and OraclePooledConnection, but now it seems that OracleConnectionCacheManager is much more useful and "powerful". Now that this is implemented, how can I add an event listener to the caching object so that when physical connection to DB goes down, my app could send a notification?

Thanks
0
whiteeagl
Asked:
whiteeagl
  • 3
1 Solution
 
whiteeaglAuthor Commented:
Is there any good/better way to check if the connection still is working?
0
 
whiteeaglAuthor Commented:
I'm still looking for a good solution concerning this connection validation problem.

Is there somthing like validationQuery for OracleDataSource or ConnectionCacheManager ?

I know that I could simply query the DB every time the users need a connection, but I guess it is just a workaround...
0
 
mariecCommented:
try with the ValidateConnection property on the Connection Cache:


OracleDataSource ods = new OracleDataSource();
ods.setURL(url);
ods.setUser(user);
ods.setPassword(pwd);
       
//Enable caching
ods.setConnectionCachingEnabled(true);
//Set the cache name
ods.setConnectionCacheName(CACHE_NAME);
       
PropertsProperties = new java.util.Properties();
sProperties.setProperty("MinLimit", "1");
sProperties.setProperty("MaxLimit", "20");
sProperties.setProperty("ValidateConnection", "true"); // Validates connection before sending to client
       
ods.setConnectionCacheProperties(sProperties);
OracleConnectionCacheManager sConnectionCacheMananger = OracleConnectionCacheManager.getConnectionCacheManagerInstance();
sConnectionCacheMananger.createCache(CACHE_NAME, ods, sProperties);
0
 
whiteeaglAuthor Commented:
thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now