Here you can find the source of createConnection()
public static Connection createConnection()
//package com.java2s; //License from project: Open Source License import java.sql.*; public class Main { private static Connection connection; private static final String ConnectionString = "jdbc:mysql://localhost:3306/tune_bazaar"; private static final String user = "miserman"; private static final String pwd = "NgxTy88"; public static Connection createConnection() { System.out.println("Creating database connection..."); String driverName = "com.mysql.jdbc.Driver"; try {/*www. j av a 2s . com*/ Class.forName(driverName); } catch (ClassNotFoundException ex) { System.out.println(ex.getMessage()); } try { connection = DriverManager.getConnection(ConnectionString, user, pwd); } catch (SQLException ex) { System.out.println("Error - Creating database connection..."); System.out.println(ex.getMessage()); } return connection; } }