Here you can find the source of openConnection()
private static void openConnection()
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; public class Main { private static Connection mConn = null; private static Statement mStmt = null; private static void openConnection() { try {// www . j av a2 s . c o m Class.forName("com.mysql.jdbc.Driver"); mConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/source_products", "root", "123"); mStmt = mConn.createStatement(); } catch (Exception e) { e.printStackTrace(); } } }