Guest User

Untitled

a guest
Jan 16th, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. private static final String url = "jdbc:mysql://127.0.0.1:3306/mybd?autoReconnect=true&useSSL=false";
  2. private static final String user = "root";
  3. private static final String password = "welcome";
  4.  
  5. private static Connection con;
  6.  
  7. public static void connecttodb() {
  8.  
  9. // opening database connection to MySQL server
  10. con = DriverManager.getConnection(url, user, password);
  11.  
  12. }
  13.  
  14. private static final String url = "jdbc:mysql://127.0.0.1:3306/mybd?autoReconnect=true&useSSL=false";
  15. private static final String user = "root";
  16. private static final String password = "welcome";
  17.  
  18. private static Connection con;
  19.  
  20. public static void connecttodb() {
  21. // This will load the MySQL driver, each DB has its own driver
  22. Class.forName("com.mysql.jdbc.Driver");
  23. // Setup the connection with the DB
  24. con = DriverManager.getConnection(url, user, password);
  25.  
  26. }
Add Comment
Please, Sign In to add comment