[odb-users] check database connection

Boris Kolpackov boris at codesynthesis.com
Tue Feb 18 23:51:32 EST 2014


Hi Changwon,

changwon lee <cwlee.nexgeo at gmail.com> writes:

> can I check if database connection is valid before use it?

What database are you using? Some databases, such as MySQL, have
the ping() function to validate the connection while for others
you will need to execute some kind of a dummy statement (which
makes the whole exercise moot since you might as well try to
execute the actual thing). Yet for others, such as SQLite, there
is no need since there is no "connection" as such.

Boris



More information about the odb-users mailing list