private static void search(Connection conn) throws SQLException {
try ( PreparedStatement stat = conn.prepareStatement("select * from town where zip=9999")) {
ResultSet res = stat.executeQuery();
while (res.next()) {
System.out.println(res.getString("zip")+" "+res.getString("name"));
}
}
}
private static void bewerk(Connection conn) throws SQLException {
try ( PreparedStatement stat = conn.prepareStatement("INSERT into town VALUEs (9999,'zzzZZZzzz')")) {
int res = stat.executeUpdate();
System.out.println(res);
}
}
Why doesn't ths code update my DB? I executed this code, checked it with sqliteBrowser(a program for opening DB's) but I can't find my new value. (automaticCommit is set on True)
Aucun commentaire:
Enregistrer un commentaire