aspose file tools*
The moose likes JDBC and the fly likes Two result set in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Two result set in JSP" Watch "Two result set in JSP" New topic
Author

Two result set in JSP

Rashmi Trivedi
Ranch Hand

Joined: Aug 13, 2001
Posts: 60
Hello all
I am struggling to get two result set working in one JSP.

I am using Apache Tomcat and SQL Server as db server.

I have declared them with different variable however when i load the JPS, it comes us with runtime error.

"busy with another query or resultset"

could you please give me some advise or an example code would be highly beneficial as i have spent lot of time on this.

Thanks in advance - much appreciated.

regards,
Rashmi Trivedi
Rohit Dhodapkar
Ranch Hand

Joined: Apr 27, 2006
Posts: 38
Hi,

I guess you should'nt bring the Result Sets in JSP and iterate them there. This is not a good practice. YOu should store the contains of the result sets in different Java Bean objects. And then iterate the beans in JSPs. This follows as Transfer Object and Value Object Pattern in J2ee design Patterns.

I guess you should disconnect the resultset first and then send it to JSPs if you want you current model to work to avoid Runtime exception .
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I agree with Rohit as far as best practices go but it sounds like this specific problem is not directly related to the fact that the code is in a JSP.

Since this is more of a JDBC issue than a JSP issue, moving to JDBC.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31054
    
162

Rashmi,
Are the two ResultSets from the same Statement object? Some drivers don't support that well. You could try using different Statement objects.

Feel free to post some code. This may help us give you a more specific answer.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Two result set in JSP