Thread: [Fwd: Re: [HACKERS] A result was returned by the statement, when none was expected]

Greetings,

Some more info in case anyone may have some clues.

The main info is we are using PreparedStatements when the problem occurs.
The same SQL works normally.  Any ideas.

Thanks in advance,

Eric





-------- Original Message --------
Message-ID: <3C855943.2010007@carl.org>
Date: Tue, 05 Mar 2002 16:48:19 -0700
From: Eric Scroger <escroger@carl.org>
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.4)
Gecko/20011019 Netscape6/6.2
X-Accept-Language: en-us
MIME-Version: 1.0
To: Dave@micro-automation.net
CC: ed@carl.org
Subject: Re: [HACKERS] [JDBC] A result was returned by the statement,
when none was expected
References: <00f701c1c49e$8bc624e0$8201a8c0@inspiron>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit



Dave,

I just installed the driver.  Unfortunately, we're still seeing the
exception.
Since we know the exception message, we can suppress it from our logs.

Thanks again for the idea.  Keep'em coming if you have more.

Eric

>Eric,
>
>The current 7.2 driver will work fine with your database, and may just
>fix your problem.
>
>Dave
>
>-----Original Message-----
>From: pgsql-hackers-owner@postgresql.org
>[mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Eric Scroger
>Sent: Tuesday, March 05, 2002 6:32 PM
>To: Dave@micro-automation.net
>Cc: 'pgsql hackers'; pgsql-jdbc@postgresql.org; ed@carl.org
>Subject: Re: [HACKERS] [JDBC] A result was returned by the statement,
>when none was expected
>
>
>Dave,
>
>>Eric,
>>
>>Which version of the driver are you using? Also do you have logs from
>>the postgres backend?
>>
>
>We are using driver jar file jdbc7.1-1.2.jar.
>
>I reproduced the problem with postgresql configured the debug setting to
>16. The backend debug logs are attached to this as they are kinda long
>(postback.log).
>
>I'm not sure it is data directly, but it does always fail on the same
>data. One thing I do know is the problem occurs when we are using
>PreparedStatments.
>If I put the same SQL statement into a separate statement it works fine.
>For your info, here is the code related to the PreparedStatements.
>
>----------------------------------------------------
>
>PreparedStatement psInsertError = null;
>
>            psInsertError = conn.prepareStatement(
>            "INSERT INTO " + tabName
>            + "(ID,DATA,ATTEMPTS,REASON) VALUES (?,?,?,?)" );
>
>            psInsertError.setLong(1,id);
>            psInsertError.setString(2,data);
>            psInsertError.setInt(3,attempts);
>            psInsertError.setString(4,reason);
>            psInsertError.executeUpdate();
>
>----------------------------
>
>Thanks for your suggestions.
>
>Eric
>
>
>>
>>My suspicion is something in the data is causing the problem, what I
>>don't know, but that's my guess.
>>
>>Dave
>>
>
>>-----Original Message-----
>>From: pgsql-jdbc-owner@postgresql.org
>>[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Eric Scroger
>>Sent: Tuesday, March 05, 2002 5:28 PM
>>To: pgsql hackers; pgsql-jdbc@postgresql.org
>>Cc: ed@carl.org
>>Subject: [JDBC] A result was returned by the statement, when none was
>>expected
>>
>>
>>JDBC-ers,
>>
>>We are doing an INSERT and occasionally Postgres throws a SQLException
>>because there are unexpected results (see stacktrace below), maybe 10%
>>of the time, Any idea why this would happen when it works over 90% of
>>the time? However, it appears the insert is completed successfully.
>>
>>We have looked at the source code for ResultSet.java and noticed the
>>method reallyResultSet() returns true if any of the fields are
>>non-null. I hope that helps in debugging.
>>
>>Also, we are running Postgres 7.1 with JDK1.2.1.
>>
>>Regards,
>>
>>Eric
>>
>>-----------------------------------------------------------------------
>>-
>>--
>>
>>IINSERT INTO bad_urls(ID,DATA,ATTEMPTS,REASON) VALUES
>>(3375,'http://www.oit.itd.umich.edu/projects/adw2k/chordata/aves.html',
>>
>0
>
>>,'Unknown
>>Host')
>>
>>A result was returned by the statement, when none was expected.
>>   at java.lang.Throwable.fillInStackTrace(Native Method)
>>   at java.lang.Throwable.fillInStackTrace(Compiled Code)
>>   at java.lang.Throwable.(Compiled Code)
>>   at java.lang.Exception.(Compiled Code)
>>   at java.sql.SQLException.(SQLException.java:98)
>>   at org.postgresql.util.PSQLException.(PSQLException.java:23)
>>   at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:80)
>>   at
>>org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.
>>
>j
>
>>ava:122)
>>   at InsertError.record(InsertError.java:98)
>>   at InsertError.record(InsertError.java:69)
>>   at wbCheckUrl$CheckThread.run(wbCheckUrl.java:307)
>>
>>
>>---------------------------(end of
>>broadcast)---------------------------
>>TIP 2: you can get off all lists at once with the unregister command
>>   (send "unregister YourEmailAddressHere" to
>>
>majordomo@postgresql.org)
>
>>
>
>




Eric,

The one thing that I don't understand is that the log from the backend
looks like it should work?

Other than that PreparedStatements do attempt to escape out some
characters, that might be a clue

Dave

-----Original Message-----
From: pgsql-hackers-owner@postgresql.org
[mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Eric Scroger
Sent: Wednesday, March 06, 2002 8:26 PM
To: pgsql-hackers@postgresql.org; pgsql-jdbc@postgresql.org
Cc: ed@carl.org
Subject: [Fwd: Re: [HACKERS] [JDBC] A result was returned by the
statement, when none was expected]


Greetings,

Some more info in case anyone may have some clues.

The main info is we are using PreparedStatements when the problem
occurs. The same SQL works normally.  Any ideas.

Thanks in advance,

Eric





-------- Original Message --------
Message-ID: <3C855943.2010007@carl.org>
Date: Tue, 05 Mar 2002 16:48:19 -0700
From: Eric Scroger <escroger@carl.org>
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.4)
Gecko/20011019 Netscape6/6.2
X-Accept-Language: en-us
MIME-Version: 1.0
To: Dave@micro-automation.net
CC: ed@carl.org
Subject: Re: [HACKERS] [JDBC] A result was returned by the statement,
when none was expected
References: <00f701c1c49e$8bc624e0$8201a8c0@inspiron>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit



Dave,

I just installed the driver.  Unfortunately, we're still seeing the
exception.
Since we know the exception message, we can suppress it from our logs.

Thanks again for the idea.  Keep'em coming if you have more.

Eric

>Eric,
>
>The current 7.2 driver will work fine with your database, and may just
>fix your problem.
>
>Dave
>
>-----Original Message-----
>From: pgsql-hackers-owner@postgresql.org
>[mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Eric Scroger
>Sent: Tuesday, March 05, 2002 6:32 PM
>To: Dave@micro-automation.net
>Cc: 'pgsql hackers'; pgsql-jdbc@postgresql.org; ed@carl.org
>Subject: Re: [HACKERS] [JDBC] A result was returned by the statement,
>when none was expected
>
>
>Dave,
>
>>Eric,
>>
>>Which version of the driver are you using? Also do you have logs from
>>the postgres backend?
>>
>
>We are using driver jar file jdbc7.1-1.2.jar.
>
>I reproduced the problem with postgresql configured the debug setting
>to 16. The backend debug logs are attached to this as they are kinda
>long (postback.log).
>
>I'm not sure it is data directly, but it does always fail on the same
>data. One thing I do know is the problem occurs when we are using
>PreparedStatments.
>If I put the same SQL statement into a separate statement it works
fine.
>For your info, here is the code related to the PreparedStatements.
>
>----------------------------------------------------
>
>PreparedStatement psInsertError = null;
>
>            psInsertError = conn.prepareStatement(
>            "INSERT INTO " + tabName
>            + "(ID,DATA,ATTEMPTS,REASON) VALUES (?,?,?,?)" );
>
>            psInsertError.setLong(1,id);
>            psInsertError.setString(2,data);
>            psInsertError.setInt(3,attempts);
>            psInsertError.setString(4,reason);
>            psInsertError.executeUpdate();
>
>----------------------------
>
>Thanks for your suggestions.
>
>Eric
>
>
>>
>>My suspicion is something in the data is causing the problem, what I
>>don't know, but that's my guess.
>>
>>Dave
>>
>
>>-----Original Message-----
>>From: pgsql-jdbc-owner@postgresql.org
>>[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Eric Scroger
>>Sent: Tuesday, March 05, 2002 5:28 PM
>>To: pgsql hackers; pgsql-jdbc@postgresql.org
>>Cc: ed@carl.org
>>Subject: [JDBC] A result was returned by the statement, when none was
>>expected
>>
>>
>>JDBC-ers,
>>
>>We are doing an INSERT and occasionally Postgres throws a SQLException
>>because there are unexpected results (see stacktrace below), maybe 10%

>>of the time, Any idea why this would happen when it works over 90% of
>>the time? However, it appears the insert is completed successfully.
>>
>>We have looked at the source code for ResultSet.java and noticed the
>>method reallyResultSet() returns true if any of the fields are
>>non-null. I hope that helps in debugging.
>>
>>Also, we are running Postgres 7.1 with JDK1.2.1.
>>
>>Regards,
>>
>>Eric
>>
>>----------------------------------------------------------------------
>>-
>>-
>>--
>>
>>IINSERT INTO bad_urls(ID,DATA,ATTEMPTS,REASON) VALUES
>>(3375,'http://www.oit.itd.umich.edu/projects/adw2k/chordata/aves.html'
>>,
>>
>0
>
>>,'Unknown
>>Host')
>>
>>A result was returned by the statement, when none was expected.
>>   at java.lang.Throwable.fillInStackTrace(Native Method)
>>   at java.lang.Throwable.fillInStackTrace(Compiled Code)
>>   at java.lang.Throwable.(Compiled Code)
>>   at java.lang.Exception.(Compiled Code)
>>   at java.sql.SQLException.(SQLException.java:98)
>>   at org.postgresql.util.PSQLException.(PSQLException.java:23)
>>   at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:80)
>>   at
>>org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement
>>.
>>
>j
>
>>ava:122)
>>   at InsertError.record(InsertError.java:98)
>>   at InsertError.record(InsertError.java:69)
>>   at wbCheckUrl$CheckThread.run(wbCheckUrl.java:307)
>>
>>
>>---------------------------(end of
>>broadcast)---------------------------
>>TIP 2: you can get off all lists at once with the unregister command
>>   (send "unregister YourEmailAddressHere" to
>>
>majordomo@postgresql.org)
>
>>
>
>




---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly