Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. **************************************كلاس التصال**********************************************
  2.  
  3. package petrotesting;
  4.  
  5. import java.sql.Connection;
  6. import java.sql.DriverManager;
  7. import javax.swing.JOptionPane;
  8. public class Connect {
  9. Connection con=null;
  10. public Connection connect(){
  11. try{
  12. Class.forName("com.mysql.jdbc.Driver");
  13. con=DriverManager.getConnection("jdbc:mysql://localhost/petrotesting","root","");
  14. JOptionPane.showMessageDialog(null,"tconnect");
  15. }catch(Exception e){
  16. JOptionPane.showMessageDialog(null,"tconnectchi");
  17. }
  18. return con;
  19.  
  20. }
  21. }
  22.  
  23.  
  24. الكلاس الرئيسي****************************************************************************
  25. /*
  26. * To change this license header, choose License Headers in Project Properties.
  27. * To change this template file, choose Tools | Templates
  28. * and open the template in the editor.
  29. */
  30. package petrotesting;
  31.  
  32.  
  33. /**
  34. *
  35. * @author TEAM 161 User
  36. */
  37. public class Petrotesting {
  38.  
  39. /**
  40. * @param args the command line arguments
  41. */
  42. public static void main(String[] args) {
  43. Connect c= new Connect();
  44. c.connect();
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement