do a "select count(*) from tablename" first. The database can count
the number of rows much faster than you can. If there's no where
clause it'll often know the answer without fetching any rows.

You are executing the query again, but since you're not transferring
any data, it should be much faster.

On Tue, May 28, 2002 at 06:53:14PM +0200, Manuel Rodriguez Diaz wrote:
> Hi all,
> I'm working with java 1.1. (this is a mandatory requirement).
> In this version of Java, resultset are "FORWARD ONLY".
> The fact is that i need to count the rows contained in a resultset
> before displaying its data and the  way i've thought to do this is read
> all the resultset.
> rows= 0;
> while( rs.next()) {
>     rows++;
> }
>
> With my actual version of java, I would need to re-execute the query
> again to get the pointer "beforeFirsted".
> Is there any way to obtain a independent copy of a ResultSet without
> executing the query again?
>
> Thankyou
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

--
Dror Matalon
Zapatec Inc
1700 MLK Way
Berkeley, CA 94709
http://www.zapatec.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to