Here you can find the source of getConnection(String driver, String url, String user, String pass)
public static Connection getConnection(String driver, String url, String user, String pass) throws InstantiationException, IllegalAccessException, SQLException, ClassNotFoundException
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.Driver; import java.sql.DriverManager; import java.sql.SQLException; public class Main { public static Connection getConnection(String driver, String url, String user, String pass) throws InstantiationException, IllegalAccessException, SQLException, ClassNotFoundException { Class<?> c = Class.forName(driver); Driver d = (Driver) c.newInstance(); DriverManager.registerDriver(d); return DriverManager.getConnection(url, user, pass); }//from w w w . j av a 2 s . c om public static Connection getConnection(String driver, String url) throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException { Class<?> c = Class.forName(driver); Driver d = (Driver) c.newInstance(); DriverManager.registerDriver(d); return DriverManager.getConnection(url); } }