Here you go (file
postgresql-7.0.3/src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java):
> /**
> * Tests to see if a Connection is closed
> *
> * @return the status of the connection
> * @exception SQLException (why?)
> */
> public boolean isClosed() throws SQLException
> {
> //return (pg_stream == null);
> if(pg_stream == null)
> return true;
> // ok, test the connection
> try {
> // by sending an empty query. If we are dead, then an SQLException should
> // be thrown
> java.sql.ResultSet rs = ExecSQL(" ");
> if(rs!=null)
> rs.close();
>
> // By now, we must be alive
> return false;
> } catch(SQLException se) {
> // Why throw an SQLException as this may fail without throwing one,
> // ie isClosed() is called incase the connection has died, and we don't
> // want to find out by an Exception, so instead we return true, as its
> // most likely why it was thrown in the first place.
> return true;
> }
> }
--- Matthias
Ted Husted wrote:
>
> Matthias Bauer wrote:
> > PostgresSQL didn't work, but we patched it
>
> Can you share your patch?
>
> -Ted.