• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Two result set in JSP

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41919
910
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic