Advertisement
Guest User

Untitled

a guest
Oct 5th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package database;
  7.  
  8. import java.sql.Connection;
  9. import java.sql.DriverManager;
  10. import javax.swing.JOptionPane;
  11.  
  12. /**
  13. *
  14. * @author rayan
  15. */
  16. public class Database {
  17.  
  18. /**
  19. * @param args the command line arguments
  20. */
  21. public static void main(String[] args) {
  22. try {
  23. Class.forName("com.mysql.jdbc.Driver");
  24. String url="jdbc:mysql://localhost:3306/dblibrary";
  25. Connection cons=DriverManager.getConnection(url,"root","");
  26. JOptionPane.showMessageDialog(null,"Found Connection");
  27.  
  28.  
  29.  
  30.  
  31. } catch (Exception e)
  32. {
  33. JOptionPane.showMessageDialog(null, e.getMessage());
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement