j ai le code suivant avec l ereur de l exeption sql non reporter
comment puis je corriger merci
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 public static void ajouterLeParc(String nom, String ville, String etat) throws SQLException, Exception { Connection c = null ; initialise(); try { Class.forName(mondriver).newInstance(); c = DriverManager.getConnection(monurl,moncompte,monpasse); } catch (ClassNotFoundException ex){ System.out.println(ex); } Statement s = c.createStatement() ; c.setAutoCommit(false) ; String table = Administration.TableParc; PreparedStatement ps = c.prepareStatement( "INSERT INTO "+ Administration.TableParc + " VALUES (?, ?, ?)"); try{ ps.setString(1,nom); ps.setString(2,ville); ps.setString(3,etat); ps.executeUpdate(); System.out.println("reussite d'ajout parc" ); } catch(SQLException e){ System.out.println("existe deja dans parc"); } c.commit() ; c.setAutoCommit(true) ; CloseConnection(c); } public void actionPerformed(ActionEvent evt) { if (evt.getSource() == lireParc ) { insererParc(repertoireParc,choixRemplace.remplace); } }PanelAjouter.java:242: unreported exception java.sql.SQLException; must be caught or declared to be thrown
ajouterLeParc(nom, ville, etat);
Partager