Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. public static Connection con;
  2.  
  3. public static void connect() {
  4. if (!isConnected()) {
  5. try {
  6. con = DriverManager.getConnection("jdbc:mysql://localhost/mixedup?autoReconnect=true&useSSL=false", "root",
  7. "159753");
  8. } catch (SQLException e) {
  9. e.printStackTrace();
  10. }
  11. }
  12. }
  13.  
  14. public static void disconnect() {
  15. if (isConnected()) {
  16. try {
  17. con.close();
  18. } catch (SQLException e) {
  19. e.printStackTrace();
  20. }
  21. }
  22. }
  23.  
  24. public static boolean isConnected() {
  25. return (con != null);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement