Multiple Result Sets
Hi, I'm a new Java programmer.
Right now, I'm working with databases in JSP.
Is it possible to include different ResultSets within each other?
For example:
ResultSet set1 = stmt.executeQuery(query1);
while(set1.next())
{ ResultSet set2 = stmt.executeQuery(query2);
while(set2.next())
{ //....code goes here
}
}
If this can't be done, is there another way to do this with JSP?
Thanks a lot!
[480 byte] By [
blue8173] at [2007-9-26 3:25:39]

Well, yes and no. You can't do it the way you're specifying. You need two database connections and each one has to be processing a separate ResultSet. Doing two from one connection will cause errors.
[code]
stmt1 = conn1.createStatement();
stmt2 = conn2.createStatement();
rst1 = stmt1.executeQuery(query1);
while (rst1.next()) {
rst2 = stmt2.executeQuery(query2);
while (rst2.next()) {
// code goes here.
}
}
Michael Bishop