Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String url = "jdbc:mysql://localhost:3306/mysql";
- String user = "root";
- String pass = "root1";
- try {
- Class.forName("com.mysql.jdbc.Driver");
- Connection connection = DriverManager.getConnection(url, user, pass);
- System.out.println("Connected to database");
- } catch (Exception e) {
- System.out.println(e);
- System.out.println("Could not connect to database");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement