Re: Need help on retrieving data from database to jsp
Posted By:
mukul_rathor
Posted On:
Sunday, March 25, 2007 01:59 AM
can u please send me code for to retriving data from database. at mukul.rathor@dhl.com
thanks in advance
mukul
Re: Need help on retrieving data from database to jsp
Posted By:
Robert_Lybarger
Posted On:
Thursday, March 15, 2007 01:08 PM
There is no single answer to this. If you know that the user will flip through all the pages of data, and if you have sufficient memory to store all the results from a single query, you'll incur (slightly) less penalty accessing the database using the single query. On the other hand, if the user will likely only look at the first page or two or results (but you know you would generate ten pages or so) it might make sense to fetch from the DB one page worth at a time. It saves a little machine memory to do it this way, but -- all things being considered equal -- a database query is usually the more expensive quantity that you want to minimize. Not knowing anything about the size of your problem or the number of users that hit it at the same time, I'd probably suggest to fetch all the results and store them into the user's session object, and construct 'next/prev' links with some sort of page number. Basically the approach my workplace's web app does things.