Skip site navigation (1) Skip section navigation (2)

JDBC: connection.isClosed() doesnt throw exception

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: JDBC: connection.isClosed() doesnt throw exception
Date: 2000-12-08 15:56:40
Message-ID: (view raw or whole thread)
Lists: pgsql-bugs
andre levy (andre(at)freever(dot)com) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
JDBC: connection.isClosed() doesnt throw exception

Long Description
connection.isClosed() doesn't throw an SQLException if "a database access error occurs". (cf

this means that if connection to db is closed, or worse, if db is down, I can't know it until I actually try to send a request!

Sample Code
This piece of code helps me to recover from a db restart without restarting my service...

  private Statement getStatement() throws SQLException {
    Statement stmt = null;

    try {
      boolean closed = m_connection.isClosed();

      if (closed)
    } catch(SQLException e) {

    stmt = m_connection.createStatement();

    return stmt;
  } // getStatement

No file was uploaded with this report

pgsql-bugs by date

Next:From: Ben TroutDate: 2000-12-09 01:52:08
Subject: Undefined symbol: pg_encoding_to_char
Previous:From: Trurl McByteDate: 2000-12-08 07:57:43
Subject: Re: Re: [ADMIN] pg_dump backup problems with password authentication

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group