Need help on retrieving data from database to jsp
2 posts in topic
Flat View  Flat View

Posted By:   kishore_kasaraneni
Posted On:   Thursday, March 15, 2007 05:11 AM

Dear all,

I am retrieving data from database using javabeans, and displaying it page wise by using jsp. And displyaing 10 records per page. while clicking on the next page I am trying to retrieve next 10 records from the databae. is it the better solution regarding preformance.

or retrieving whole data at a time and place it in a vector objects. and displaying them by page by page.

which one is the better solution.

Thanks and regards,

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


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.
About | Sitemap | Contact