Re: Result Set FORWARD_ONLY

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Jeffrey Melloy <jmelloy(at)visualdistortion(dot)org>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Result Set FORWARD_ONLY
Date: 2005-09-23 02:04:45
Message-ID: 433362BD.5030606@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message yoursoft@freemail.hu 2005-09-23 07:24:30 Re: [Fwd: Re: JDBC driver bug?]
Previous Message Jeffrey Melloy 2005-09-23 01:34:57 Result Set FORWARD_ONLY