now i am able to reproduce this error.
the error occurs if you set a (nullable) parameter in a prepared statement to null the "wrong way".
here are 4 examples and what happens
***
PreparedStatement stmt ...;
stmt.setObject(3,new Date(1000)); // no error
stmt.setObject(3,(java.sql.Date)null); // no error
stmt.setDate(3,(java.sql.Date)null); // -> ERROR: insufficient data left in message
stmt.setNull(3,java.sql.Types.DATE); // -> ERROR: insufficient data left in message
***
really surprising to me is that it seems impossible to set NULL values via "setDate" and even more
surprising is that "setNull(...)" using the correct datatype does not work. i dont think that this is the
expected behavior and the error message is misleading too.
another interesteing behaviour is that, if you get this error you will also get this error running
the correct statement. but after calling the correct statement a few times the error message will disappear.
regards sepp
Wann haben Sie das letzte Mal Ihre Freunde oder Familie gesehen? Unlimitierte Videotelefonate mit dem Windows Live Messenger. Hier klicken!
Wann haben Sie das letzte Mal Ihre Freunde oder Familie gesehen? Unlimitierte Videotelefonate mit dem Windows Live Messenger. Hier klicken!
No comments:
Post a Comment