#3 un-deprecate testConnectionOnCheckout


testConnectionOnCheckout is extremely useful, but too
expensive in the current implementation. Attached is a
class (SQLConnectionTester) which allows a configurable
SQL to be run instead of checking database meta data.
Each database will need its own concrete subclass of
SQLConnectionTester which sets the sql to be run in the
constructor. For example, the class for Oracle could
set the sql to "select count(*) from dual" while the
class for Ingres could set the sql to "select count(*)
from $ingres.iitables". That query is basically free
for Oracle, and much faster for Ingres. My
implementation of statusOnException is very basic, but
should suffice.


  • Eric Fenderbosch

    3 java files, SQLConnectionTester and 2 concrete subclasses

  • Steve Waldman

    Steve Waldman - 2004-12-01

    Logged In: YES


    Thanks a lot for this! I'm sorry I didn't see it! I didn't have this tracker
    set up to e-mail me, and never looked here. Pretty lame, I know.
    Anyway, changes similar to those you want are implemented in c3p0
    -0.8.5-preX, except users don't need to define their own
    ConnectionTester classes to use an SQL query any more. There is a
    preferredTestQuery parameter they can use instead.
    testConnectionOnCheckout was only deprecated because, as you noted,
    the default, database-independent implementation is very expensive. It
    is no longer deprecated, and more options for connection testing have
    been added.

    Sorry once again for the long non-response! I've set the feature request
    tracker to e-mail me at last, so hopefully it won't happen again...

    And thanks again for your work and suggestions.


  • Steve Waldman

    Steve Waldman - 2005-03-25
    • status: open --> closed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks