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.Driver; import java.sql.DriverManager; import java.sql.SQLException; public class Main { public static Connection getConnection() { try {/*w w w. j a va 2 s .c om*/ DriverManager.registerDriver((Driver) Class.forName("com.mysql.jdbc.Driver").newInstance()); String url = "jdbc:mysql://" + //db type "localhost:" + //host name "3306/" + //port "db_example?" + //db name "user=tully&" + //login "password=tully"; //password return DriverManager.getConnection(url); } catch (SQLException | InstantiationException | IllegalAccessException | ClassNotFoundException e) { throw new RuntimeException(e); } } }