pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Jeffrey Melloy <jmelloy@visualdistortion.org>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Result Set FORWARD_ONLY
Date: Fri, 23 Sep 2005 14:04:45 +1200
Message-ID: <433362BD.5030606@opencloud.com> (raw)
In-Reply-To: <7EAC0D28-F7CC-4924-8244-CF8AD2874314@visualdistortion.org>
References: <7EAC0D28-F7CC-4924-8244-CF8AD2874314@visualdistortion.org>

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



view thread (2+ messages)

Message-ID: <433362BD.5030606@opencloud.com>
Permalink:  ../433362BD.5030606@opencloud.com/
Also on:    postgresql.org/message-id/433362BD.5030606@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, jmelloy@visualdistortion.org
  Subject: Re: Result Set FORWARD_ONLY
  In-Reply-To: <433362BD.5030606@opencloud.com>
  References: <7EAC0D28-F7CC-4924-8244-CF8AD2874314@visualdistortion.org> <433362BD.5030606@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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