Re: A result was returned by the statement, when none was expected

From: Eric Scroger <escroger(at)carl(dot)org>
To: Dave(at)micro-automation(dot)net
Cc: "'pgsql hackers'" <pgsql-hackers(at)postgresql(dot)org>, pgsql-jdbc(at)postgresql(dot)org, ed(at)carl(dot)org
Subject: Re: A result was returned by the statement, when none was expected
Date: 2002-03-05 23:31:46
Message-ID: 3C855562.9030403@carl.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

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(at)postgresql(dot)org
>[mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of Eric Scroger
>Sent: Tuesday, March 05, 2002 5:28 PM
>To: pgsql hackers; pgsql-jdbc(at)postgresql(dot)org
>Cc: ed(at)carl(dot)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.<init>(Compiled Code)
> at java.lang.Exception.<init>(Compiled Code)
> at java.sql.SQLException.<init>(SQLException.java:98)
> at org.postgresql.util.PSQLException.<init>(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(at)postgresql(dot)org)
>
>

Attachment Content-Type Size
postback.log text/plain 17.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-03-06 00:22:17 Re: Intervening in Parser -> Planner Stage
Previous Message Nicolas Bazin 2002-03-05 23:22:14 Fw: Postgresql backend to perform vacuum automatically

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-03-05 23:40:47 Re: is anyone use executeQuery with autogeneratedkeys function ?
Previous Message Dave Cramer 2002-03-05 22:56:52 Re: A result was returned by the statement, when none was expected