Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- public class TestMySQLConnection {
- static String username = "root";
- static String password = "root";
- // static String dbUrl = "jdbc:mysql://localhost:3306/world?autoReconnect=true&useSSL=false";
- static String dbUrl = "jdbc:mysql://localhost:3306/world";
- public static void main (String[] args) throws SQLException {
- Connection conn = null;
- try {
- conn = DriverManager.getConnection(dbUrl, username, password);
- System.out.println("Connection established to MYSQL database");
- } catch (SQLException e) {
- System.err.println(e.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement