Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- Class.forName("com.mysql.jdbc.Driver");
- con = DriverManager.getConnection("jdbc:mysql:/127.0.0.1:3306/MyDB",
- "USER", "PW");
- if(!con.isClosed())
- System.out.println("Successfully connected to " +
- "MySQL server using TCP/IP...");
- } catch(Exception e) {
- System.err.println("Exception: " + e.getMessage());
- } finally {
- try {
- if(con != null)
- con.close();
- } catch(SQLException e) {}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement