Here you can find the source of getConnection()
public static Connection getConnection() throws Exception
//package com.java2s; //License from project: Open Source License import java.sql.*; public class Main { private static final String url = "jdbc:mysql://127.0.0.1:3307/user"; private static final String user = "root"; private static final String password = "010203"; private static Connection conn = null; public static Connection getConnection() throws Exception { if (conn == null) { conn = DriverManager.getConnection(url, user, password); return conn; }//from w w w . j ava2 s.com return conn; } }