Re: JDBC Connection returns wrong status



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

.



Relevant Pages

  • Re: java app hangs in sybase JDBC driver calling isClosed
    ... Hmm. ... that's what Sybase's driver is doing. ... anything the driver is sending to the DBMS is being ignored. ... like the connection had been left idle long enough to be ...
    (comp.databases.sybase)
  • Re: unknow exception from jdbc driver
    ... where can get the error log of dbms. ... "Joe Weinstein" wrote: ... but the exception give nothing for error cause. ... is the connection still ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: connection timeouts
    ... Experiencing a problem whereby a jdbc connection seems to become stuck while ... It might be that your statement's SQL is blocked by locks in the ... DBMS that are being held by another process. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: Pooling of connections
    ... The process of making a new connection is slow. ... a new socket from the client to the DBMS, ... includes opening a communication path between the two components ...
    (comp.lang.java.databases)
  • Re: Question about .rc files
    ... "Vincent Fatica" wrote in message ... Is the RC spec some sort of machine-independent representation? ...
    (microsoft.public.vc.language)