If you use a scollable resultset, you will have to keep an open
connection to the database. This can be an issue with a Web application.

With a Cacheable RowSet you would not need to keep the connection open,
but you would need to store the entire set in memory. 

Either way, you would need a mechanism to change the settings for the
interator, which probably means round trips to the server. 

I know it sounds wasteful, but personally I would think about getting a
page at a time. This is more work on the DBMS as they go to later pages,
but many times they don't go past the first page. Otherwise you will
need to keep the resultset in the session and tie up memory.

A lot of people like to use the pager tag from JSP tags for this sort of
thing.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/


Mindaugas Idzelis wrote:
> 
> Thanks for all your answers. This has been very nerve wrecking. I think I've
> come up with a solution that may work in a DB independent way. I'll use a
> scrollable resultset. I won't iterate through all of it, only portions at a
> time. I think most underlying JDBC drivers use "cursors" to implement the
> scrollable resultset. Is this a valid approach?
> 
> --min

Reply via email to