Advertisement
Guest User

conn

a guest
Mar 18th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3.  
  4. import javax.swing.JOptionPane;
  5.  
  6. public class SQLConnection {
  7.  
  8. static Connection conn;
  9. public static Connection ConnecrDb() {
  10. try {
  11.  
  12. Class.forName("com.mysql.jdbc.Driver");
  13. conn = DriverManager.getConnection("jdbc:mysql://localhost:3307/uttara", "root","");
  14.  
  15. //JOptionPane.showMessageDialog(null, "Success");
  16. return conn;
  17.  
  18. }
  19. catch(Exception e) {
  20. JOptionPane.showMessageDialog(null, "Failed");
  21. return null;
  22. }
  23. }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement