Advertisement
Guest User

connection

a guest
Apr 27th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. public class MySqlConnect {
  2.  
  3.     static Connection ConnectDB() {
  4.         try{
  5.             Class.forName("com.mysql.jdbc.Driver");
  6.             Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/aplogin","root","7191007Ar");
  7.             System.out.println("SQL script was successfully applied to the database.");
  8.             return conn;
  9.         }catch(Exception e){
  10.             System.out.println(e);
  11.             return null;
  12.         }
  13.     }
  14.     Connection conn = null;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement