Here you can find the source of getConnection()
public static Connection getConnection() throws ClassNotFoundException, SQLException
//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 conn; public static Connection getConnection() throws ClassNotFoundException, SQLException { if (null == conn) { connect();//from w ww . java2 s . c om } return conn; } public static Connection connect() throws ClassNotFoundException, SQLException { if (conn == null) { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:mysql://sqld.duapp.com:4050/rzUowhpAxCAvlnfNPBqx", "N1iOGk7wiI5mecGukBwtwP8D", "VXSsFTyN1NQF3f13qtte29EWKsc2Kucu"); } return conn; } }