Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- public class MysqlConnect {
- public static void main(String[] args) {
- try {
- Class.forName("org.gjt.mm.mysql.Driver").newInstance();
- Connection con = DriverManager.getConnection("jdbc:mysql://stusql.dcs.shef.ac.uk/hcsd2?user=hcsd2&password=roastbeef");
- System.out.println("Connected to the database");
- con.close();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
Add Comment
Please, Sign In to add comment