Here you can find the source of getConnection()
public static Connection getConnection()
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { public static final int PORT = 9002; public static final String DB_NAME = "wukonglin"; public static final String DB_PATH = "./db/"; public static final String USER_NAME = "sa"; public static final String PASSWORD = ""; public static final int SERVER_MODE = 0; public static final int STAND_ALONE_MODE = 1; public static int mode = SERVER_MODE; public static Connection getConnection() { Connection conn = null;// w w w. ja va 2 s.c o m try { Class.forName("org.hsqldb.jdbcDriver"); if (mode == SERVER_MODE) { conn = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost:" + PORT + "/" + DB_NAME, USER_NAME, PASSWORD); } else if (mode == STAND_ALONE_MODE) { conn = DriverManager.getConnection("jdbc:hsqldb:file:" + DB_PATH + DB_NAME, USER_NAME, PASSWORD); } } catch (ClassNotFoundException ex) { ex.printStackTrace(); } catch (SQLException ex) { ex.printStackTrace(); } return conn; } }