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 { public static final String DB_URL = "jdbc:postgresql://localhost:5432/events"; public static final String USERNAME = "postgres"; public static final String PASSWORD = "rame"; public static Connection getConnection() { Connection con = null;/*ww w . j a va2s . c o m*/ try { Class.forName("org.postgresql.Driver"); con = DriverManager.getConnection(DB_URL, USERNAME, PASSWORD); } catch (ClassNotFoundException | SQLException ex) { System.out.println(ex.getMessage()); } return con; } }