Re: next() error - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: next() error
Date
Msg-id 4202AE28.2080300@opencloud.com
Whole thread Raw
In response to next() error  (Nahum Castro <nahumcastro@gmail.com>)
Responses Re: next() error  (Nahum Castro <nahumcastro@gmail.com>)
List pgsql-jdbc
Nahum Castro wrote:

> javax.servlet.ServletException: ResultSet not positioned properly,
> perhaps you need to call next.

> Has changed something on the server or on the driver?

Newer drivers follow the JDBC specification more strictly.

> ResultSet RecordsetPubs1 = StatementRecordsetPubs1.executeQuery();
> boolean RecordsetPubs1_isEmpty = ! RecordsetPubs1.next();
> boolean RecordsetPubs1_hasData = ! RecordsetPubs1_isEmpty;

[...]

>     <td align="left" width="50%"><%=(((RecordsetPubs1_data =
> RecordsetPubs1.getObject("au_id"))==null ||
> RecordsetPubs1.wasNull())?"":RecordsetPubs1_data)%></td>

You appear to be calling ResultSet.getObject() even if ResultSet.next()
returned false. You're not allowed to do this -- see the JDBC javadoc.

-O

pgsql-jdbc by date:

Previous
From: Nahum Castro
Date:
Subject: next() error
Next
From: Nahum Castro
Date:
Subject: Re: next() error