| Author |
Setting max results from query
|
John Lindwall
Ranch Hand
Joined: May 29, 2002
Posts: 31
|
|
We use a Weblogic-specific class called QueryDataSet to perform searches in our webapp. A QueryDataSet is a convenient way to execute a select and retrive the results in a ResultSet-like form. The advantage that QueryDataSets had over straight Statements/ResultSets is that we can retrieve only the first n results, process them, and then fetch the next n results, proces them, etc. This avoids keeping jillions of result records in memory when you only want to display, say, 10 at a time to the user. Does JDBC 2.0 offer something similar? I'd like to move away from this Weblogic-specific solution. Thanks!
|
 |
Jamie Robertson
Ranch Hand
Joined: Jul 09, 2001
Posts: 1879
|
|
Yes, that is the way it works in jdbc 2.0 as well. There is a method that may allow you change it to a value that you want called setFetchSize() ( available at both the statement and resultset level ). Note: This is not the same as setMaxRows() Jamie [ August 16, 2002: Message edited by: Jamie Robertson ]
|
 |
Jamie Robertson
Ranch Hand
Joined: Jul 09, 2001
Posts: 1879
|
|
another note: I have seen scrollable resultsets keep previously fetched records in memory ( the next 10 records does not replace, but is added to the previously fetched records in memory ), which when fetching a few million rows can add up to a lot of memory.
|
 |
 |
|
|
subject: Setting max results from query
|
|
|