Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String url = "jdbc:mysql://localhost:3306/javabase";
- String username = "java";
- String password = "password";
- System.out.println("Connecting database...");
- try (Connection connection = DriverManager.getConnection(url, username, password)) {
- System.out.println("Database connected!");
- } catch (SQLException e) {
- throw new IllegalStateException("Cannot connect the database!", e);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement