Java JDBC H2 Connection isH2DbAlreadyRunning()

Here you can find the source of isH2DbAlreadyRunning()

Description

is H Db Already Running

License

Apache License

Declaration

public static boolean isH2DbAlreadyRunning() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.sql.Connection;
import java.sql.DriverManager;

public class Main {
    private static String h2DbJdbcUrl = "jdbc:h2:tcp://localhost:8092/mem:camunda;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE";

    public static boolean isH2DbAlreadyRunning() {
        try {//from  w w w.  j  a v  a2 s . com
            Connection connection = DriverManager.getConnection(
                    h2DbJdbcUrl, "sa", null);
            connection.close();
            return true;
        } catch (Exception ex) {
            return false;
        }
    }
}

Related

  1. deleteDatabase()
  2. deleteDatabaseH2()
  3. getConnection()
  4. getH2Connection(String dbname)
  5. getH2Connection(String filename)
  6. rollback(Savepoint sp)
  7. setAutoCommit(Boolean b)