retrieving multiple results is very easy, You just need to use the
getMoreResults function.
a very simplified code snippet would look like:
// get the first result set
boolean lb_found_rs;
lrs_data = luo_stmt.getResultSet();
//logic to do what you want with current result set
// Move on to next result set
lb_found_rs = luo_stmt.getMoreResults();
lrs_data = luo_stmt.getResultSet();
Casey Kochmer
[EMAIL PROTECTED]
>From: Jimmi Dyson <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
> reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Multiple results sets
>Date: Tue, 13 Jun 2000 09:10:14 +0100
>
>That works for a single result set with multiple rows, but how about
>retrieving multiple result sets?
>
> -----Original Message-----
> From: Irfan Mohammed [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, June 12, 2000 7:00 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Multiple results sets
>
> in order to read all the records returned by the execution of a
>query do
> this
> while(rs.next()){
> do whatever
> }
>
> rs.next() advances the pointer to the next record in the result
>set
>and that
> way you can go till the end of the result set.
>
> You could read the api under java.sql.* to understand this
>function
>better.
>
> Irfan
>
> -----Original Message-----
> From: Jimmi Dyson [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 12, 2000 4:13 AM
> To: [EMAIL PROTECTED]
> Subject: Multiple results sets
>
>
> Hi.
> After executing a stor proc with multiple ResultSets selected, how
>do you
> get each of the ResultSets back? The code below gets back the
>first
> resultset selected by P_dindin, but not the second. What am I
>doing
>wrong?
> ps.getMoreResults() is true when it is called, but rs1 never gets
>any
> results back.
> My code that I thought was correct looks like this:
>
> try {
> Class.forName(...NameOfDriver...).newInstance();
> Connection con = DriverManager.getConnection(...URL...);
> CallableStatement cs = con.prepareCall("{call P_dindin}");
> ResultSet rs;
> if (cs.execute()) {
> rs = cs.getResultSet();
> .....do stuff.......
> if (cs.getMoreResults()) {
> rs = ps.getResultSet();
> ....do more stuff....
> }
> }
> } catch (Exception ex) {....}
>
> Thank you in advance.
> Jimmi Dyson
>
>
>===========================================================================
> 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
>
>===========================================================================
>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
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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