Here you can find the source of getConnection(String dbFile)
public static Connection getConnection(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<>(); public static Connection getConnection(String dbFile) { checkConnection(dbFile);/*www . j a va2 s . co m*/ return connections.get(dbFile); } private static void checkConnection(String dbFile) { try { 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 String getDbURL(String dbFile) { return "jdbc:h2:" + dbFile + ";MODE=MySQL;FILE_LOCK=NO"; } }