Pretending your driver is in the path,
String url = "jdbc:mysql://localhost/test";
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
Connection conn = DriverManager.getConnection (url, "username", "password");
Want to become a SQL Expertise? Register now to the SQL Course and get certified.
For more details on MySQL, refer to the below MySQL Tutorial video.