Here you can find the source of getConnection()
public static Connection getConnection() throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { private static Connection connection; private static String url = null; private static String username = null; private static String password = null; public static Connection getConnection() throws SQLException { if (connection == null) { connection = DriverManager.getConnection(url, username, password); }/*from w w w. j a v a2 s . c om*/ return connection; } }