• 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

Big ResultSet

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have a sql that retrieves more than 50k rows. I need to display these values in the selectbox(dropdown) on my JSP screen.

When I do so, I get outOFmemeory Exception and operation timed out.

One solution I found was to use Statement.setMaxRows(int max).

But, does this restrict the rows to be displayed or fetches only the number of rows set(say for example 50). If yes, how to retrieve the other rows into the drop down?

Any other suitable suggestions?

Regards
 
author & internet detective
Posts: 41860
908
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
Navi,
setMaxRows() limits the total number of rows returned. setFetchSize() returns them in smaller batches. This helps avoid OutOfMemory errors in the driver. You still need to take care not to introduce one in your code.

From a usability perspective, do you have all 50,000 rows in the same drop down? This seems like it would be hard to find the relevant item in.
 
navi kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes Jeanne,

It would be hard for the users to dive in and search in the drop down of 50000 values.
But, basically, when the user screen is shown, this values should be in drop down. Later they are supposed to select an id, which when done will be submitted to the server and only relavant(in sense, the values where id="selected") will be dropped in the drop down.

And thanks for you reply.
 
reply
    Bookmark Topic Watch Topic
  • New Topic