Here you can find the source of getConnection()
public static Connection getConnection()
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.DriverManager; public class Main { public static Connection getConnection() { Connection conn = null;//w ww .j a va2s .c om try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/desk", "root", "root"); return conn; } catch (Exception e) { e.printStackTrace(); return null; } } }