Connection.isClosed(0 is a pretty useless method. By spec, all it means
is whether *you* closed the connection. There is no way to know a
connection
is still good except to try and use it. Even if there was an
isThisConnectionGood()
method, the DBMS could go down right after you called it, so you have
to code
in a way that handles filed connections at any time, as best you
can....
GetMetaData() just returns you an object. You'd have to make an actual
metadata call, and one that requires talking to the DBMS, to see if the
connection
was good. ANd even if you do something like getting the database
version,
the driver may have already cached that from when it first logged in.
Do a "select 1" if you want to test...
Joe Weinstein at BEA Systems
Robert Klemme - 18 Dec 2006 14:19 GMT
Adding to Joe's comment: the ODBC JDBC bridge is not one of the best
drivers around. I suggest you use one of the native drivers (the one
provided by MS or jTDS). You are a lot less likely to run into troubles
with those plus they'll work on *all* platforms and have no added
dependencies (unless you want to use NTLM).
Kind regards
robert