Re: Nmber of rows in a ResultSet - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Nmber of rows in a ResultSet
Date
Msg-id Pine.LNX.4.33.0401090323370.6759-100000@leary.csoft.net
Whole thread Raw
In response to Nmber of rows in a ResultSet  ("Xavier Bugaud" <xavier.bugaud@gloptv.com>)
List pgsql-jdbc

On Fri, 9 Jan 2004, Xavier Bugaud wrote:

> Hi all,
>
> JDBC does not allow to directly retrieve the number of rows in a
> ResultSet.
> However, in old Postgres JDBC drivers (pgjdbc2.jar), the number of rows
> contained in a ResultSet could be obtained by calling getFetchSize().

This was just an implementation artifact and the javadoc for the method
should have made you wary of using it in the way you are.

> In the last JDBC drivers, is there a means to get the number of rows
> directly (without using 'SELECT COUNT(*)' or 'rs.last();rs.getrow();') ?

I don't see what's so wrong with rs.last() and rs.getRow().

Kris Jurka


pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: PreparedStatement parameters and mutable objects
Next
From: Kris Jurka
Date:
Subject: Re: [BUG] - Invalid UNICODE character sequence found (0xc000)