Here is what we have done,
Greetings,
I had a situation like this where the Result set from a
database query was to large to put in one HTML file.
So I did the following:
1-decide how many rows the users wants to see in one HTML
page( say 5 records per screen).
2-Say your result set contains 53 records, thus you have to
create 11 HTML pages, the first 10 containing 5 rows per
page, and the last containing 3 per page.
3-Start processing the ResultSet object, get the first 5 rows
create an HTML page for them, create the next 5 rows,
create the second HTML page for them,
4-Fork a Thread that handles creating the other 9 Pages, and
return the first page so that the user doesn't have to wait
for the other 9 pages.
5-When the last page is done being created, create a Thread, that
Deletes all the files, say in 1/2 hour from now.
6-Make sure the naming of your temp files is random and unique
so that there is no collision between 2 or more requests.
7-Make sure that each page has links to the page before it and
after it so that the user can SEQUENTIALLY(not randomly) access
all the pages of the result set. In database parlance, let the
user CURSE back and forth the Result Set.
8-You can add the session ID to the "Previous Page" or "Next Page"
link.
To see it all work using ServletExec 2.1 go to
http://ccap.courts.state.wi.us/InternetCourtAccess/
Good luck and enjoy.
Hani
--
Jon Lee wrote:
>
> Currently looking at the best way to deal with http requests for result sets
>obtained from an SQL (DB2 AS400) database.
> I am using a stateful session bean to access this database.
> I am sure this must be a common issue.
> For example, a request effectively asks for a 500 row table to be returned.
> I want to return 50 of these rows in a response to the user, and then give them the
>option of returning the next 50 or previous 50, etc.
>
> a) I can limit the number of rows being returned using setMaxSize() on my prepared
>statement, but I am then unsure of how I can obtain the next set of records, when
>requested, as JDBC does not seem to allow me to do this (anyone know anything about
>this?)
>
> b) I can bring back the whole 500 row result set, store it on the StatefulSB as a
>cachedresultset(?) or as a Collection of some kind. Hopefully weblogic's container
>would effectively manage the memory use that this would involve, but I would save
>myself trips to the database (offsite).
>
> This must have been solved many times before, what do people think?
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".