I had an update like this:
update table set col1=?,col2=?,col3=? where col4=?;
and I filled it up like this:
statement.setString(1,"some_value");
statement.setString(2,"some_value");
statement.setString(3,"some_value");
and I forgot to add a fourth value.I did a executeUpdate and of course nothing happened to the database. I spent about 1 hour debugging it, to see where it goes wrong. I then modified my code to print the SQLWarning object returned by the getWarnings method.
It always returned null. I even modified the code to the buggy state it was, before I set the fourth parameter, and still no warning. Does anyone know how one can get an error/warning?
If it matters, my Connection is set to autoCommit.
executeUpdatereturns the number of rows modified by the statement. You can check to see if this result is0, and if it is, then log your own warning.