1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Connection con = null;
ResultSet rs = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/db?useSSL=false","root","");
PreparedStatement st =con.prepareStatement("USE db; INSERT INTO liens_parentaux( Nature_Du_Lien, Nom, Prenom, Matricule_Du_Proche, Matricule) VALUES( ?, ?, ?, ?, ? ); " );
st.setString(1, Nature_Lien);
st.setString(2, Nom_Parent);
st.setString(3, Prenom_Parent);
st.setString(4, Matricule_Parent); //Ces deux matricules (Matricule_Parent et Matricule) sont de type Char(8) dans la base de données, et je les envoie sous forme de String
st.setString(5, Matricule);
st.executeUpdate();
}
catch(Exception ex){ex.printStackTrace();} |
Partager