Here you can find the source of getDBConnection()
private static Connection getDBConnection()
//package com.java2s; //License from project: Open Source License import java.sql.DriverManager; import java.sql.Connection; import java.sql.SQLException; public class Main { static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; static final String DB_URL = "jdbc:mysql://127.0.0.1:3306/twitch"; static final String USER = "java"; static final String PASS = "java"; private static Connection getDBConnection() { Connection dbConnection = null; try {/* ww w . j a va2s .co m*/ Class.forName(JDBC_DRIVER); } catch (ClassNotFoundException e) { System.out.println(e.getMessage()); } try { dbConnection = DriverManager.getConnection(DB_URL, USER, PASS); return dbConnection; } catch (SQLException e) { System.out.println(e.getMessage()); } return dbConnection; } }