Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **************************************كلاس التصال**********************************************
- package petrotesting;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import javax.swing.JOptionPane;
- public class Connect {
- Connection con=null;
- public Connection connect(){
- try{
- Class.forName("com.mysql.jdbc.Driver");
- con=DriverManager.getConnection("jdbc:mysql://localhost/petrotesting","root","");
- JOptionPane.showMessageDialog(null,"tconnect");
- }catch(Exception e){
- JOptionPane.showMessageDialog(null,"tconnectchi");
- }
- return con;
- }
- }
- الكلاس الرئيسي****************************************************************************
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package petrotesting;
- /**
- *
- * @author TEAM 161 User
- */
- public class Petrotesting {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Connect c= new Connect();
- c.connect();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement