Can't you deal with the connection being closed in your finally block by using this code:

if (connection != null && !connection.isClosed()) connection.close();


On Dec 6, 2008, at 6:50 PM, [EMAIL PROTECTED] wrote:

The second message -- connection has already been closed -- most likely arises from my code structure, which is:

Connection connection = null;
PreparedStatement prepStmt = null;
try
{
  Connection connection = getConnection();
  PreparedStatement prepStmt = connection.prepareStatement(...);
  ...
}
finally
{
  if (prepStmt != null) prepStmt.close();
  if (connection != null) connection.close();
}

The call to getConnection() in the try block gets a connection from the pool. But the server has closed this connection. Therefore the call to prepareStatement throws a SQLException which is the last packet exception.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to