JDBC Connection validation

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

JDBC Connection validation

Gérald Quintana
Hello,

I am evaluating stale JBDC connection checking solutions and have some
questions:
- When is the test query executed? On connection borrow? Are there
"testOnBorrow, testOnReturn, testWhileIdle" options like DBCP?
- How expensive is a test query? Is it possible to execute it, only if
connection has been stale for X milliseconds so as to reduce the cost?
- enableJdbc4ConnectionTest option is not documented (in JDBC Pool
Configuration), is its usage safe and efficient (on Oracle)?

Thanks for your advice,
Gérald

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: JDBC Connection validation

Ludovic Orban-2
The test query is executed on borrow and there are no settings equivalent to testOnReturn nor testWhileIdle nor anything else: either you configure it and it's always executed on borrow or you don't configure it and there is no way to check for stale connections.

How expensive it is depends on the query you configured and your database. Generally this summarizes up to little more than a network round-trip between your app server and your DB.

jdbc4ConnectionTest is a slightly experimental feature. When set and a JDBC 4 driver is detected the test query is replaced with the new JDBC 4 connection testing mechanism. This is supposed to be faster but I've never ran any serious performance test to measure the potential gain.


2010/12/9 Gérald Quintana <[hidden email]>
Hello,

I am evaluating stale JBDC connection checking solutions and have some
questions:
- When is the test query executed? On connection borrow? Are there
"testOnBorrow, testOnReturn, testWhileIdle" options like DBCP?
- How expensive is a test query? Is it possible to execute it, only if
connection has been stale for X milliseconds so as to reduce the cost?
- enableJdbc4ConnectionTest option is not documented (in JDBC Pool
Configuration), is its usage safe and efficient (on Oracle)?

Thanks for your advice,
Gérald

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email