• 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

working with multiple resultsets

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
is it possible to open multiple resultsets concurrently.i am having problems when working with resultset.i want to execute two sql statements and i need to compare the data(which is retreived from the database).so i have created two ResultSet objects.when i try to execute the class it is giving cursor closed error.can anybody help me in this regard.

Thanks in advance.
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

If you post some of code, you will probably get the help you want.

Herman
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Only one ResultSet can be open per Statement (see the ResultSet javadocs for this). Thus, if you want multiple ResultSets, you need multiple Statements.
 
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Depends on what you mean. For example sybase jconnect driver allows you to return N ResultSets per query. I doubt you could iterate through them simultaneously. You could put them in some other data structure (arrayList for example) first.
 
pradeep samudrala
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi steve,
the solution you suggested is good.but the problem with the solution(guess) is it degrads the performance.let us suppose i have 1lac records in the table, retreiving them to some data structure like vector and accessing them from the vector could cause some performance degradation.instead of copying them to some datastructure,if we can access from the ResultSets concurrently then it could be a better solution.i am using ORACLEDATABASE(9i) and oracle thin driver.is it possible with this DRIVER.
Thanks in advance.
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any reason that you could not create a virtual table (using VIEW) that incorporates the data from both sets? Any time either data set is updated, the updates will be reflected in the virtual table. I don't know how you are comparing the data, but comparisons can be built into the table also. Then you would only need a single query.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It will be helpful if you can post some code that you are trying to use.

By the way, Did you think of using RowSet instead of ResultSet? This will avoid building a new data structure.
 
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic