Here you can find the source of getConnection(String ip, String dataBaseName, String password, String username)
public static Connection getConnection(String ip, String dataBaseName, String password, String username) throws SQLException
//package com.java2s; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { private static String url = "jdbc:mysql://"; private static String driver = "com.mysql.jdbc.Driver"; private static Connection con; public static Connection getConnection(String ip, String dataBaseName, String password, String username) throws SQLException { try {//from w w w. ja v a 2 s .c om Class.forName(driver); } catch (ClassNotFoundException e) { e.printStackTrace(); } String urlStr = url + ip + "/" + dataBaseName + "?useUnicode=true&characterEncoding=UTF-8"; try { con = DriverManager.getConnection(urlStr, username, password); } catch (SQLException e) { e.printStackTrace(); throw e; } return con; } }