Here you can find the source of getConnection()
public static Connection getConnection()
//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 String db_driver; private static String db_url; private static String db_userName; private static String db_passWord; public static Connection getConnection() { Connection con = null;/* w w w . java 2s . com*/ try { Class.forName(db_driver); } catch (ClassNotFoundException e) { System.out.println("3-ClassNotFoundException"); e.printStackTrace(); return null; } try { con = DriverManager.getConnection(db_url, db_userName, db_passWord); } catch (SQLException e) { System.out.println("4-SQLException"); e.printStackTrace(); return null; } return con; } }