Here you can find the source of getConnection()
public static Connection getConnection() throws SQLException, ClassNotFoundException
//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 conn; private static final String mysqlDriver = "com.mysql.jdbc.Driver"; private static final String mysqlURL = "jdbc:mysql://localhost:3306/course"; private static final String username = "course6"; private static final String password = "course6"; public static Connection getConnection() throws SQLException, ClassNotFoundException { Class.forName(mysqlDriver); conn = DriverManager.getConnection(mysqlURL, username, password); return conn; }/*from w ww. ja v a 2 s. c o m*/ }