Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3. public class MyDB {
  4.  
  5. private static String
  6. schema = "yeet",
  7. user = "root",
  8. pass = "root",
  9. path = "jdbc:mysql://localhost:3306/"+schema;
  10.  
  11. public Connection getCon()
  12. throws InstantiationException, IllegalAccessException,ClassNotFoundException, SQLException {
  13.  
  14. Connection c;
  15. Class.forName("com.mysql.jdbc.Driver").newInstance();
  16. c = DriverManager.getConnection(path,user,pass);
  17. return c;
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement