import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Main {
public static void main(String[] args) throws Exception {
Connection conn = null;
conn = getConnection("jdbc:mysql://localhost/empDB", "root", "rootpass");
conn.close();
}
public static Connection getConnection(String dbURL, String user, String password)
throws SQLException, ClassNotFoundException {
Class.forName("com.mysql.jdbc.Driver");
return DriverManager.getConnection(dbURL, user, password);
}
}