Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1.     static Connection getConnection() throws Exception {
  2.  
  3.         String url = "jdbc:mysql://localhost:3306/";
  4.         String dbName = "test";
  5.         String driver = "com.mysql.jdbc.Driver";
  6.         String userName = "userparatest";
  7.         String password = "userparatest";
  8.  
  9.         Class.forName(driver).newInstance();
  10.         Connection conn = DriverManager.getConnection(url + dbName, userName,password);
  11.  
  12.         return conn;
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement