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

From Robert Wimmer
Subject insufficient data left in message II
Date
Msg-id BAY139-W2743EB558BBD1A44F37B36D0D90@phx.gbl
Whole thread Raw
Responses Re: insufficient data left in message II  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
.hmmessage P{margin:0px;padding:0px}body.hmmessage{FONT-SIZE: 10pt;FONT-FAMILY:Tahoma}> Date: Tue, 29 Apr 2008 16:37:03 +1200
> From: oliver@opencloud.com
> To: seppwimmer@hotmail.com
> CC: pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] ERROR: insufficient data left in message
>
> Robert Wimmer wrote:
> > I always get the error 'insufficient data left in message' running a
> > prepared statement via jdbc executeQuery
>
ican locate the problem better now. the prepared insert statement is NOTthe origin cause. if the following lines are commented out no errorwill occur only SOMETIMES and the insert and the update statement willwork as expected.

***
// should not be found
//if (proxy.get(person,new Long(45678)))
//  System.out.println('found : ' + person.toString()); <<<< here is the problem
//  else System.out.println('not found : ' + person.toString());
**** and now the rest works fine
// update
person.setFirstName('Homero');
if (proxy.update(person)) System.out.println('updated : ' + person.toString());
            else System.out.println('not updated : ' + person.toString());
// insert a new one
            Person person2 = new Person();
            person2.setFirstName('Ropert');
            person2.setLastName('Wimmer');
            person2.setReadOnly(false);
            person2.setBirthDay(null);
            if (proxy.insert(person2)) System.out.println('inserted : ' + person2.toString());
            else System.out.println('inserted : ' + person2.toString());
            }
**** output
updated : [1] Simpson, Homero (readOnly=false, private=)
inserted : [null] Wimmer, Ropert (readOnly=false, private=)
done
****

thestrange thing is if I run the program above from the command line theresult depends on what happend during the last call of the program. soif i change the program in the IDE in a way that an error will occurthe sam error will also occur from the commandline for the next 2 or 3times - afterwards it will work as expected.

my suspicion is, that if  the get statement  returns nothing this error will occur.
***
ResultSet rs = this.getStatement.executeQuery();
if (rs.first()) { readResultSet(rs,data);  ret = true; }
rs.close();
// getStatement = 'SELECT * FROM person.person WHERE id =  ?'
***
butthe error only will occur if I run  an insert or update statementafterwards. I.E. if i only do not find  no error will occur but if iupdate or insert afterwards this error will occur ! and vice versa - aslong as there is no NOT FOUND  the insert & update statement willwork.

if a reproduce this situation (not finding data) i get the following log entries
***
2008-04-29 12:14:54 CEST LOG:  unexpected EOF on client connection
2008-04-29 12:14:58 CEST LOG:  could not receive data from client: Connection reset by peer
2008-04-29 12:14:58 CEST LOG:  unexpected EOF on client connection
2008-04-29 12:15:01 CEST LOG:  could not receive data from client: Connection reset by peer
2008-04-29 12:15:01 CEST LOG:  unexpected EOF on client connection
2008-04-29 12:15:06 CEST LOG:  could not receive data from client: Connection reset by peer
2008-04-29 12:15:06 CEST LOG:  unexpected EOF on client connection
2008-04-29 12:15:13 CEST LOG:  could not receive data from client: Connection reset by peer
2008-04-29 12:15:13 CEST LOG:  unexpected EOF on client connection
2008-04-29 12:15:22 CEST LOG:  could not receive data from client: Connection reset by peer
2008-04-29 12:15:22 CEST LOG:  unexpected EOF on client connection
***
the 'unexpected EOF ...' is very suspicous to me.

any ideas ?

regards sepp

Es ist höchste Zeit, dabei zu sein - Holen Sie sich jetzt die neue Generation der Windows Live Services! Hier klicken!

pgsql-jdbc by date:

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