I am (successfully) connecting to a database using the following:
java.sql.Connection connect = DriverManager.getConnection(
\"jdbc:mysql://localhost/some_
The low-cost method, regardless of the vendor implementation, would be to select something from the process memory or the server memory, like the DB version or the name of the current database. IsClosed is very poorly implemented.
Example:
java.sql.Connection conn = ;
conn.close();
try {
conn.getMetaData();
} catch (Exception e) {
System.out.println("Connection is closed");
}