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: | 200012081556.eB8Fues97175@hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
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
http://java.sun.com/j2se/1.3/docs/api/java/sql/Connection.html#isClosed())
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)
openDb();
} catch(SQLException e) {
closeDb();
openDb();
}
stmt = m_connection.createStatement();
return stmt;
} // getStatement
No file was uploaded with this report
From | Date | Subject | |
---|---|---|---|
Next Message | Ben Trout | 2000-12-09 01:52:08 | Undefined symbol: pg_encoding_to_char |
Previous Message | Trurl McByte | 2000-12-08 07:57:43 | Re: Re: [ADMIN] pg_dump backup problems with password authentication |