This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

handling a larg size result set

 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all:
How can I handle a larg size result set? Lets say over 1000 records. I am using sql2k, and it doesn't support RowSet. Currently, I am using transfer object stratgy, but with that many objects stored in the user session, alot of memory resources is lost. Is there any other stratgies?
thank you
 
Brian K Swingle
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would try making your SQL statement more exact. Try to let you database do all the work and just return the record you want. Instead of looping through the result set. If thats what you doing. If you can post your code i might be able to be more help full
Best Regards,
Brian
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And why do you feel you need to store the data in the user session (I assume we are talking about a web app here)? You really haven't given us enough context on how the data is used to be able to make concrete recommedations.
[ April 13, 2004: Message edited by: Bear Bibeault ]
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you all for your reply. I will try to explain in a simple example what I mean.
Consider a database table that contains ISP providers. Each provider has: first name, last name, id, cost, ...ext. Lets say each record contains about 5 fields. Now, assuming someone want to bring and be able to look at all this data at a time. The result set will contain all the ISP providers, which is very larg. I want to display the initial information to the user like the name of the provider in a jsp page, also, the user should be able to shoose one or more provider to display all the detaild information.
My approch was to encapsulate each ISP provider record in a transfer object and add it to a list. I mentain the list in a user session, so that the user can nevigate throgh the ISP provider records without having to go back to the database.
I am looking for a standerd design, and not just a solution for a problem.
thanks again
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the data is the same no matter who is logged into the system, then storing the cached DB data in the application scope would be better than in each user's session.
In the case of 1000 records, it's a trade-off. Do you want to use up the memory so that DB access is limited, or save the memory and take the DB access hit?
If the dataset gets really big, then unless you have Google's server farm, you are better off taking the DB hit.
Taking a step back, I would say that large data sets are actually useless to the user (can they really assimilate that much data?) and you are better off allowing then to specify what subsets of the data they actually want to see.
[ April 13, 2004: Message edited by: Bear Bibeault ]
 
Brian K Swingle
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yea I completely agree with Bear on this. He said it all.
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys
I totaly agree with you guys. But, becuase I have some bosses in my job, I can't do what I see appropriate. Our DBA doesn't want frequent access to the database, and my project manager wants to give the user the ability to do any search the user want. No one want to compermise or understand.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic