Re: insufficient data left in message II - Mailing list pgsql-jdbc

From Robert Wimmer
Subject Re: insufficient data left in message II
Date
Msg-id BAY139-W20841742A109388528A87ED0D90@phx.gbl
Whole thread Raw
In response to Re: insufficient data left in message II  (Robert Wimmer <seppwimmer@hotmail.com>)
Responses Re: insufficient data left in message II  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
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!

pgsql-jdbc by date:

Previous
From: Robert Wimmer
Date:
Subject: Re: insufficient data left in message II
Next
From: Oliver Jowett
Date:
Subject: Re: insufficient data left in message II