You can move to next row by using rs.next(), for fetching the next column u have to
use the rsmetadata reference. So the two approach which you are thinking are
different have to be used collectively to fetch the records.
rs.next() move vertically and for horizontal movement you'll use for loop till end
of the column count.


Sanjay

Venu Gopal wrote:

> Hi all,
>
> I'm new to Java/JDBC. I'm using JSP and i'm using
> Resin 1.2 for JSP. Ok Now.. i have following doubts
> regarding JDBC / JSP:
>
> 1. Suppose i have executed a query and got the results
> in result set rs. Then which of the following is the
> best method to browse through the records fetched:
>
> Result rs = st.executeQuery("select *....");
>
> Method 1:
> ---------
>
> while (rs.next())
> {
>    // get the records, do some operations
> }
>
> Method 2:
> --------
>
> ResultSetMetaData rsMeta = rs.getMetaData();
> int numCols = rsMeta.getColumnCount();
>
> for (int i=0; i<numCols; i++) {
>    // get the records
> }
>
> Which one of the above two methods is good in terms of
> fastness, performance ?
>
> 2. I have a question regarding persistance of DB
> connection between the JSP to Servlet calls? I mean in
> a JSP i have a database handle returned from a
> connection class bean. And can i pass this connection
> handle to other program (either JSP, Servlet)??
> Whether this handle is persistant from that other
> program? Shall i be able to query the same db from the
> second program?
>
> Pardon me for the ignorance.
>
> Thanks in advance,
> kindly help,
> Venu
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Photos - 35mm Quality Prints, Now Get 15 Free!
> http://photos.yahoo.com/
>
> ===========================================================================
> 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

===========================================================================
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

Reply via email to