JSP and SQL Problem

jgbishop

Senior member
May 29, 2003
521
0
0
I want to run two simple queries from a database using SQL (from a JSP). My problem is that I don't quite understand how to use the ResultSet object. Can I do something like the following?

Statement s = c.createStatement();

ResultSet rs = s.executeQuery(query_one);
while(rs.next()) {
// Do something
}

rs. = s.executeQuery(query_two);
while(rs.next()) {
// Do something else
}

In other words, can I reuse a ResultSet variable to run multiple queries? Or must I have a unique ResultSet for each query?
 

jgbishop

Senior member
May 29, 2003
521
0
0
Yes. I miswrote the subject of the message. Sorry about that.

And thanks for the help!