Neal Cabage wrote:
>
> Does anyone know how to return a recordCount when using JDBC? For instnace,
> in ADO (Microsoft world) recordCount is simply a property of the recordSet
> object. Is there something that provides a similar functionality? I need
> that value *prior* to moving through the records so simply incrementing a
> value is not an option.
There is an option, but it's expensive. In JDBC the ResultSet is Cached,
so effectively the number of rows is not known. However you can do:
(Only with JDBC2 drivers and scrollable resultsets)
int rows = 0;
rs.last();
rows = rs.getRow();
rs.beforeFirst();
Much faster would be to do a "select count() from table where blablabla"
before you get your resultset.
sven
--
======================================================================================
Sven van 't Veer http://www.cachoeiro.net
Java Developer [EMAIL PROTECTED]
======================================================================================
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets