private static void process(String urlSource, String urlTarget, String user, String password, String serverList) throws SQLException { org.h2.Driver.load(); // use cluster='' so connecting is possible // even if the cluster is enabled try (Connection connSource = DriverManager.getConnection(urlSource + ";CLUSTER=''", user, password); Statement statSource = connSource.createStatement()) { // enable the exclusive mode and close other connections, // so that data can't change while restoring the second database statSource.execute("SET EXCLUSIVE 2"); try { performTransfer(statSource, urlTarget, user, password, serverList); } finally { // switch back to the regular mode statSource.execute("SET EXCLUSIVE FALSE"); } } }