JDBC: connection.isClosed() doesnt throw exception
| От | pgsql-bugs@postgresql.org |
|---|---|
| Тема | JDBC: connection.isClosed() doesnt throw exception |
| Дата | |
| Msg-id | 200012081556.eB8Fues97175@hub.org обсуждение исходный текст |
| Список | pgsql-bugs |
andre levy (andre@freever.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
В списке pgsql-bugs по дате отправления: