How can I get an error or a warning from a PreparedStatement?
Posted
by Geo
on Stack Overflow
See other posts from Stack Overflow
or by Geo
Published on 2010-06-07T18:09:08Z
Indexed on
2010/06/07
18:12 UTC
Read the original article
Hit count: 190
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.
© Stack Overflow or respective owner