Here you can find the source of createConnection()
public static Connection createConnection()
//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 Connection connection; public static String driver; public static String connectionURL; public static String user; public static String password; /**//from ww w . j av a 2 s. co m * Method to return the connection * * @return Connection */ public static Connection createConnection() { try { // Loading the driver Class.forName(driver); // Creating a connection connection = DriverManager.getConnection(connectionURL, user, password); } catch (ClassNotFoundException exception) { System.out.println("Driver not found"); } catch (SQLException exception) { System.out.println("Connection exception" + exception); } return connection; } }