Here you can find the source of checkConnection(String dbFile)
private static void checkConnection(String dbFile)
//package com.java2s; //License from project: Open Source License import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; public class Main { private final static Map<String, Connection> connections = new HashMap<>(); private static void checkConnection(String dbFile) { try {//from w w w .jav a2 s . com Connection connection = connections.get(dbFile); if (connection.isClosed()) initializeConnection(dbFile); } catch (SQLException e) { throw new RuntimeException(e); } } public synchronized static void initializeConnection(String dbFile) { try { Connection connection = DriverManager.getConnection(getDbURL(dbFile)); connections.put(dbFile, connection); } catch (Exception ex) { throw new RuntimeException(ex); } } public static Connection getConnection(String dbFile) { checkConnection(dbFile); return connections.get(dbFile); } public static String getDbURL(String dbFile) { return "jdbc:h2:" + dbFile + ";MODE=MySQL;FILE_LOCK=NO"; } }