Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. public static Connection createConnection() throws ClassNotFoundException,
  2. SQLException {
  3. Class.forName("com.mysql.jdbc.Driver");
  4. connection = DriverManager.getConnection(
  5. "jdbc:mysql://localhost/festivaldatabase", "root", "abcd1234");
  6. log.info("----Connection established with MYSQL database----");
  7. return connection;
  8. }
  9.  
  10. /**
  11. * <br/>
  12. * METHOD DESCRIPTION: <br/>
  13. * Close connection accessing the underlying database. <br/>
  14. *
  15. * @throws SQLException
  16. *
  17. */
  18. public static void closeConnection() throws SQLException {
  19. log.info("----Connection closed with MYSQL database----");
  20. connection.close();
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement