Here you can find the source of createConnection(String hostname, String port, String database, String username, String password)
public static Connection createConnection(String hostname, String port, String database, String username, String password)
//package com.java2s; //License from project: Open Source License import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { public static Connection createConnection(String hostname, String port, String database, String username, String password) {/*from ww w.j a v a 2s . c o m*/ try { return DriverManager.getConnection( "jdbc:mysql://" + hostname + "/" + database + "?user=" + username + "&password=" + password); } catch (SQLException e) { } return null; } }