Advertisement
Guest User

Untitled

a guest
Sep 11th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. package sample;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5.  
  6. public class ConConfig {
  7. public static Connection getConnection()
  8. {
  9. Connection connection_object = null;
  10. try
  11. {
  12. Class.forName("com.mysql.cj.jdbc.Driver");
  13. final String url = "jdbc:mysql://localhost:3306/easynotes";
  14. final String user = "root";
  15. final String password = "admin";
  16. connection_object = DriverManager.getConnection(url, user, password);
  17. }
  18. catch (Exception e)
  19. {
  20. e.printStackTrace();
  21. }
  22. return connection_object;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement