Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: insufficient data left in message II



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!


Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group