Guest User

Untitled

a guest
Apr 20th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. class DBConfig {
  2.  
  3. private static final String DRIVER_CLASS_NAME = "com.mysql.jdbc.Driver";
  4. private static final String CONN_STRING = "jdbc:mysql://localhost:3306/demo";
  5. private static final String USER = "root";
  6. private static final String PASSWORD = "1234";
  7.  
  8. private static Connection conn;
  9.  
  10. static Connection getConnection() throws ClassNotFoundException, SQLException {
  11.  
  12. Class.forName(DRIVER_CLASS_NAME);
  13. conn = DriverManager.getConnection(CONN_STRING, USER, PASSWORD);
  14. return conn;
  15.  
  16. }
  17.  
  18. }
Add Comment
Please, Sign In to add comment