pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedResult Set FORWARD_ONLY
2+ messages / 2 participants
[nested] [flat]
* Result Set FORWARD_ONLY
@ 2005-09-23 01:34 Jeffrey Melloy <jmelloy@visualdistortion.org>
0 siblings, 1 reply; 2+ messages in thread
From: Jeffrey Melloy @ 2005-09-23 01:34 UTC (permalink / raw)
To: pgsql-jdbc
I'm having trouble setting the result set to anything but FORWARD_ONLY.
If I do this:
pstmt = conn.prepareStatement("select name, name from
amz.product_detail_items order by name");
rs = pstmt.executeQuery();
rs.setFetchDirection(ResultSet.TYPE_SCROLL_INSENSITIVE);
I get:
org.postgresql.util.PSQLException: Invalid fetch direction constant:
1,004.
I get the same error if I set it on the pstmt object before executing
the query.
Using version 311 of the JDBC driver and 8.0.2.
Thanks,
Jeff
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Result Set FORWARD_ONLY
@ 2005-09-23 02:04 Oliver Jowett <oliver@opencloud.com>
parent: Jeffrey Melloy <jmelloy@visualdistortion.org>
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Jowett @ 2005-09-23 02:04 UTC (permalink / raw)
To: Jeffrey Melloy <jmelloy@visualdistortion.org>; +Cc: pgsql-jdbc
Jeffrey Melloy wrote:
> pstmt = conn.prepareStatement("select name, name from
> amz.product_detail_items order by name");
> rs = pstmt.executeQuery();
> rs.setFetchDirection(ResultSet.TYPE_SCROLL_INSENSITIVE);
>
> I get:
>
> org.postgresql.util.PSQLException: Invalid fetch direction constant: 1,004.
The driver is working correctly here.
You can only set the resultset type when creating the statement, like so:
> pstmt = conn.prepareStatement("select name, name from amz.product_detail_items order by name", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet.setFetchDirection() is used to hint to the driver about the
expected order of resultset use, not to set the resultset type. It
expects one of ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, or
ResultSet.FETCH_UNKNOWN. The driver is (correctly) complaining that
you're giving it some other value.
The java.sql javadoc covers all this.
-O
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-09-23 02:04 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-09-23 01:34 Result Set FORWARD_ONLY Jeffrey Melloy <jmelloy@visualdistortion.org>
2005-09-23 02:04 ` Oliver Jowett <oliver@opencloud.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox