Here you can find the source of getConnection(String ip, String db, String user, String passWord)
protected static Connection getConnection(String ip, String db, String user, String passWord)
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.DriverManager; public class Main { /**/*from w ww.j av a 2 s.c o m*/ * @return */ protected static Connection getConnection(String ip, String db, String user, String passWord) { Connection conn = null; try { Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://" + ip + "/" + db; conn = (Connection) DriverManager.getConnection(url, user, passWord); } catch (Exception e) { e.printStackTrace(); } return conn; } }