Advertisement
Guest User

Untitled

a guest
Oct 4th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. String url = "jdbc:mysql://localhost:3306/mysql";
  2. String user = "root";
  3. String pass = "root1";
  4.  
  5. try {
  6. Class.forName("com.mysql.jdbc.Driver");
  7. Connection connection = DriverManager.getConnection(url, user, pass);
  8. System.out.println("Connected to database");
  9. } catch (Exception e) {
  10. System.out.println(e);
  11. System.out.println("Could not connect to database");
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement