Connection openNewConnection() throws SQLException {
  Connection newConn=DriverManager.getConnection(url,user,password);
  if (url.startsWith("jdbc:derby:")) {
    try (Statement s=newConn.createStatement()){
    }
   }
 else   if (url.startsWith("jdbc:hsqldb:")) {
    try (Statement s=newConn.createStatement()){
      s.execute("SET WRITE_DELAY 1");
    }
   }
  return newConn;
}

Connection openNewConnection ( ) throws SQLException { Connection newConn = DriverManager . getConnection ( url , user , password ) ; if ( url . startsWith ( "jdbc:derby:" ) ) { try ( Statement s = newConn . createStatement ( ) ) { } } else if ( url . startsWith ( "jdbc:hsqldb:" ) ) { try ( Statement s = newConn . createStatement ( ) ) { s . execute ( "SET WRITE_DELAY 1" ) ; } } return newConn ; }
open a new database connection . this connection must be closed by calling conn . close ( ) .
