Erreur =====> SQLException: e2
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 for (int i=0 ; i < inf.length ; i++ ){ try { String strClassName = "com.mysql.jdbc.Driver"; String strUrl = "jdbc:mysql://localhost/BD?user=root&password=root"; String strInsert = "INSERT INTO personne (nom, Prenom) VALUES ('" + inf[i].localisation + "', '" + inf[i].Couleur + "');"; //Exemple de valeur à charger, mais je ne sais pas comment le coder et comment faire pour qu'il fasse toute les lignes du fichier texte. Class.forName(strClassName); Connection conn = DriverManager.getConnection(strUrl); Statement stAddUser = conn.createStatement(); stAddUser.executeUpdate(strInsert); conn.close(); } catch(SQLException e2) { System.out.println("SQLException: e2 "); } } }
Je vois pas l'erreur
Partager