Here you can find the source of getConnection()
public static Connection getConnection()
//package com.java2s; // LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { private final static String jdbc = "com.mysql.jdbc.Driver"; private final static String sqlHome = "jdbc:mysql://localhost:3306/test"; private final static String other = "?useUnicode=true&characterEncoding=utf-8"; private final static String userName = "root"; private final static String passWord = "zzHe"; public static Connection getConnection() { Connection con = null;// w w w .j a va2s. c om try { Class.forName(jdbc); con = DriverManager.getConnection(sqlHome + other, userName, passWord); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } return con; } }