you can use

        int i=0;

        i=rs.getFetchSize();

to count the number of records.

Regards
Deepak


--- "S. Chen" <[EMAIL PROTECTED]> wrote:
> Happy New Year to All!
>
> Hi, I have a JDBC question.
>
> I have a database and I need to retrive the latest
> 100 transactions into my
> jsp page.  I am planning to do it this way:
>
> String query = "select * from table1 order by
> trans_date desc";
> ResultSet rs = stmt.executeQuery(query);
> int count=0;
> while (rs.next()&& count <100) {
>   String s = rs.getString("Name");
>   float n = rs.getFloat("Price");
>   ...
>   count++;
> }
>
> The problem is soon enough there will be over 10,000
> transactions in the
> database.  If I do it this way, it will be not
> efficient.  so I want to use
> the method setFetchSize(100). Since I am new to java
> and jsp, I don't know
> how and where to use this method. Could anybody help
> me? Thanks very much!
>
>
>
_________________________________________________________________
> Get your FREE download of MSN Explorer at
> http://explorer.msn.com
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body:
> "set JSP-INTEREST DIGEST".
> 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


__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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

Reply via email to