hello
voici l'erreur apres execution du code qui va suivre
unreported exception: java.lang.ClassNotFoundException; must be caugth or declared to be thown

voici mon code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 
import java.net.*;
import java.util.*;
import java.sql.*;
public class connectiondb{ 
 
	Connection conn = null; 
        Statement S=null;
        ResultSet RS=null;
 public connectiondb(String cf,String df,String phf)
 {cf=null;df=null;phf=null;};   
 public void connectiondb() throws ClassNotFoundException{
 
         String strClassName = "sun.jdbc.odbc.JdbcOdbcDriver";
         String strUrl = "jdbc:odbc:BD_Incidents";
         Class.forName(strClassName);
         String username="sa";
         String password="sa";
 
          //username=nom utilisateur
           //password=mot de passe
               try {
         conn = DriverManager.getConnection(strUrl,"",""); 
      }
       catch(Exception  e){
         //System.err.println("Driver non chargé !");
         e.printStackTrace();  
       }
   }
 public void insertion_filiale(String cf, String df, String phf){
     try{	 String sql="insert into filiale values('"+cf+" 
','"+df+"','"+phf+"')";
                 int Ligne;
                 S=conn.createStatement();
                 Ligne=S.executeUpdate(sql);
    	}catch(Exception e){
		System.out.println("erreur lors connection bd("+e+")");
	}
 
 }
 public void selection_filiale(String cf, String df, String phf){
     try{	 
                 String sql="select * from filiale";
                 S=conn.createStatement();
                 RS=S.executeQuery(sql);
                 int nlig=RS.getMetaData().getColumnCount();
                 while(RS.next()){
                     cf=RS.getString(1);
                     df=RS.getString(2);
                     phf=RS.getString(3);
                 }
    	}catch(Exception e){
		//System.out.println("erreur lors connection bd("+e+")");
	}
 
 }
et voici l'appel dans JFfiliale()
[code]
connectiondb con=new connectiondb();
con.connectiondb();
con.insertion_filiale(cf,df,phf);
con.selection_filiale(cf,df,phf);