Here you can find the source of getConnection()
public static Connection getConnection()
//package com.java2s; //License from project: Open Source License import java.sql.*; public class Main { public static Connection getConnection() { Connection conn = null;//w w w. j ava 2s.co m String url = "jdbc:mysql://localhost:3306/record"; String user = "root"; String password = "123"; try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(url, user, password); } catch (Exception e) { e.printStackTrace(); } return conn; } }