isClosed()

Syntax:

boolean isClosed() throws SQLException

Description:

Retrieves whether this Connection object has been closed. A connection is closed if the method close has been called on it or if certain fatal errors have occurred. This method is guaranteed to return true only when it is called after the method Connection.close has been called.

This method generally cannot be called to determine whether a connection to a database is valid or invalid. A typical client can determine that a connection is invalid by catching any exceptions that might be thrown when an operation is attempted.

Returns:

true if this Connection object is closed; false if it is still open

Throws:

SQLException - if a database access error occurs

Reference:

For more information, reference JDBC documentation for: Connection.isClosed()