Here you can find the source of getConnection()
public static java.sql.Connection getConnection()
//package com.java2s; //License from project: Apache License import java.sql.DriverManager; import java.sql.SQLException; public class Main { private static java.sql.Connection con; public static java.sql.Connection getConnection() { try {//from w w w.ja va 2 s. c o m Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://localhost:3306/banco07"; con = DriverManager.getConnection(url, "root", ""); con.setAutoCommit(true); return con; } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException se) { se.printStackTrace(); } return null; } }