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.DriverManager; import java.sql.SQLException; public class Main { private static Connection con; public static Connection getConnection() { String url = "jdbc:mysql://localhost:3306/management"; String username = "root"; String password = "2806"; if (con != null) { return con; } else {/*from w ww. j a va 2 s . co m*/ try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection(url, username, password); } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } return con; } }