Here you can find the source of getConnection()
public static Connection getConnection()
//package com.java2s; //License from project: Open Source License import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { private static Connection con; public static Connection getConnection() { if (con == null) { try { //System.out.println("1"); Class.forName("com.mysql.jdbc.Driver"); con = DriverManager .getConnection("jdbc:mysql://localhost:3306/facturacion?user=root&password=1111"); //con = DriverManager.getConnection("jdbc:mysql://192.168.200.18:3306/facturacion?user=root&password=1111"); //System.out.println("2"); con.setAutoCommit(false); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace();//w w w . j a v a 2s . c o m } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return con; } }