I have an application and I am using a customized framework, which is similar to Struts + Hibernate. The problem I am facing is that, suppose an user is using the application and if the database shuts down, the user gets an error page saying "Runtime Error"(This page is already configured by my application ). Now I don't want the user to get this page in case the database is "up" and running again. In short, I want to refresh all the stale connections(from the Connection Pool) and let the user start afresh without any error page.
I am using Oracle 10g
FYI: I have already tried OracleConnectionCacheManager's refreshCache(cacheName, mode) method and it doesn't work, for me atleast.
The method I have used for getting a connection is below:
Don't walk as if you rule the world, walk as if you don't care who rules it...
Thanks for your response. No I am not using any validation query. I thought it might hamper the performance a bit. Is it so? I am not completely aware of the consequences and also not sure how exactly does a validationQuery work .
What do you suggest? Any other options are also welcome.
you have to choose a very cheap query that returns at least one row, like "select 1 from dual".
This query is executed every time you ask a connection from the pool.
If the query does not return at least one row (that means: something is wrong) the pool discards the bad connection, and creates a brand new connection.
This mechanism is not very expensive, and helps you a lot.
No I am not using any validation query. I thought it might hamper the performance a bit.
My advise is: don't just assume that something is bad for performance.
Joined: Jan 05, 2010
Thanks again Jan!!...
Could you help with using it? How do I configure it? I searched for "validationQuery" configuration, but found little help.
I am using JBoss 4
P.S.: Thanks for the advice too, I'll keep that in mind.