Hi,
If the driver supports JDBC 2.0,
you could try this:
Step 1. resultSet.last(); OR resultSet.absolute(-1); //positions the
cursor on the last row
Step 2. resultSet.getRow();
//Retrieves the current row number. The first row is number 1, the second number
//2, and so on
-Kiran.
Anup K M A wrote:
> hi
> there is o method in the JDBC API giving this.
> The best way would be to issue a 'select count' sql query with the
> necessary conditions before you execute the actual query
>
> regards
> Anup
>
> At 04:31 PM 8/9/00 +0530, you wrote:
> >hi Silvia,
> > u can use this
> >
> >
> >int i = 0 ;
> >
> >while(r.next()) // here r is the object of type
> >ResultSet u get after executing the query
> >
> > {
> > i++ ;
> > }
> >
> >at the end of the loop i will give u the no of recds .
> >
> >
> >-----Original Message-----
> >From: A mailing list for discussion about Sun Microsystem's Java Servlet
> >API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> >Silvia Gaspar
> >Sent: Wednesday, August 09, 2000 3:26 PM
> >To: [EMAIL PROTECTED]
> >Subject: Number of Records
> >Importance: High
> >
> >
> > What function give us the number of records retrieved by a query?
> >I'm using JDBC.
> >
> >
> >
> >Regards,
> >----------------------------------------------------------------------------
> >-------------------------------
> >Compta - Equipamentos e Servi�os de inform�tica, S.A
> >
> >S�lvia Gaspar
> >Engenharia de Sistemas e Aplica��es
> >Implementa��o
> >Consultora S�nior
> >* TEL: +351.21. 350 14 00
> >* Directo: +351.21. 313 55 51
> >* Fax: +351.21.352 02 02
> >* e-mail: [EMAIL PROTECTED]
> >* WWW: www.compta.pt
> >
> >___________________________________________________________________________
> >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
> >
> >___________________________________________________________________________
> >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
> >
>
> ___________________________________________________________________________
> 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
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.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