1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| try {
// Connect to the local database
String url = "jdbc:mysql://localhost/test" ;
String login = "root";
String password = "";
Connection conn = DriverManager.getConnection(url,login,password);
// Query the employee names
Statement stmt = conn.createStatement ();
String requete = "INSERT INTO client (heure_arrivee,temps_guichet) VALUES ('22:44:55',3)";
stmt.execute(requete);
stmt.close();
conn.close();
}
catch ( Exception E ) {
JOptionPane.showMessageDialog(new Frame(),"Impossible de se connecter à la base de donnée!");
} |
Partager