Subject | Connection.isClosed() |
---|---|
Author | Ian A. Newby |
Post date | 2007-01-17T16:35:17Z |
Hi Folks,
I have a hashmap of connections, which may contain duplicate
connections. The connections are obtained from a FBWrappingDatasource.
I'm trying to commit and close the connections in a loop. Obviously, I
don't want to commit and close the same connection twice.
My code to do this is as follows:
for (Connection con : connections.values()) {
if (!con.isClosed()) {
con.commit();
con.close();
}
}
However, on the if (!con.isClosed()) { line I get the following error...
org.firebirdsql.jdbc.FBSQLException: Connection
org.firebirdsql.pool.PooledConnectionHandler@94a28e was closed. See
the attached exception to find the place where it was closed
org.firebirdsql.pool.PooledConnectionHandler.invoke(PooledConnectionHandler.java:209)
$Proxy12.isClosed(Unknown Source)
uk.co.tpmi.engine.DBWriter.doPost(DBWriter.java:194)
Should a check whether a connection is closed throw an exception if it is?
Regards
Ian Newby
I have a hashmap of connections, which may contain duplicate
connections. The connections are obtained from a FBWrappingDatasource.
I'm trying to commit and close the connections in a loop. Obviously, I
don't want to commit and close the same connection twice.
My code to do this is as follows:
for (Connection con : connections.values()) {
if (!con.isClosed()) {
con.commit();
con.close();
}
}
However, on the if (!con.isClosed()) { line I get the following error...
org.firebirdsql.jdbc.FBSQLException: Connection
org.firebirdsql.pool.PooledConnectionHandler@94a28e was closed. See
the attached exception to find the place where it was closed
org.firebirdsql.pool.PooledConnectionHandler.invoke(PooledConnectionHandler.java:209)
$Proxy12.isClosed(Unknown Source)
uk.co.tpmi.engine.DBWriter.doPost(DBWriter.java:194)
Should a check whether a connection is closed throw an exception if it is?
Regards
Ian Newby