• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Where does the ResultSet reside?

 
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi:
Where does the returned ResultSet reside? After a SQL statement executed and a ResultSet is returned, is it still in the dbms, or it is brought to the application server memory?
If it resides in the memory, why it is gone after the statemet created it is closed?
If it reside on the dbms, how can I bring it to the memory?
thanks
 
author & internet detective
Posts: 42135
937
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
Hannah,
A regular result set resides in memory on the application server. I think there are some settings where you can get it to only load the first X rows and go back to the database to get more. But by default, it's all in memory.
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hit Jeanne:
Thanks for your replay. If the ResultSet lives in the application memory, why it is gone when the connection, or the statement created are closed? and how can I bring to the memory a part of the result set?
thanks
 
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javax.sql.RowSet
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javax.sql.RowSet interface is not supported by SQL 2000 ..!!
 
Jeanne Boyarsky
author & internet detective
Posts: 42135
937
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
Hannah,
You can loop through the result set and put the rows in your own data structure. An ArrayList is common for this sort of thing.
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi:
I know I can user transfer objects to store my data from the ResultSet, but when the ResultSet is huge, it will takes up a lot of memory. I know there is another solution, is to user RowSet, but I am using SQL2k, and it doesn't support RowSet.
any other suggestions.
 
Jeanne Boyarsky
author & internet detective
Posts: 42135
937
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
Hanna,
What are you doing with the data after you have it? Is it something you can do while the resultset is open? For example if you are writing to a file, you can do that as you loop through the result set.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic