• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Two result set in JSP

 
Rashmi Trivedi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34214
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic