Re: insufficient data left in message II

From: Robert Wimmer <seppwimmer(at)hotmail(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: insufficient data left in message II
Date: 2008-04-29 21:58:26
Message-ID: BAY139-W20841742A109388528A87ED0D90@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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!

_________________________________________________________________
Sie lieben Hotmail? Jetzt ist es noch besser. Drag and Drop, neue Lesebereichlayouts, verbesserte Sicherheit und 5GB GRATIS Speicherplatz machen die Online-Kommunikation um vieles einfacher. Das neue Windows Live Hotmail. Eröffnen Sie JETZT Ihr Konto!
http://get.live.com/mail/overview/

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2008-04-29 22:21:44 Re: insufficient data left in message II
Previous Message Robert Wimmer 2008-04-29 15:46:27 Re: insufficient data left in message II