If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How make a good paging

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-13-03, 22:59
yuvensius yuvensius is offline
Registered User
 
Join Date: Nov 2003
Posts: 2
Wink How make a good paging

Anybody know how make a good paging in db2?
Usually i retrieve all data from db2 and got the resultset object within a conditional from query like :

sql = "SELECT * from MSEmployee where Name like '%" + condition + "'%"

I always take 10 record for one page.
after that i got ResutlSet object and in this resultset i process to get data from it start and end with :
ResultSet rs = conn.createStatement(sql);
rs.absolute(start);

So if i use this mehtod from resultset , the pointer will point to that record position within start and take 10 data.
My Problem is i take all data in database and can make a traffic network. so if i have a million data , but i just want to display 10 data is make a not efficient for db2 and traffic. So anybody know how can i select 10 data directly from db2 and not processed in resultset?

Best Regards...
Reply With Quote
  #2 (permalink)  
Old 11-15-03, 15:35
cchattoraj cchattoraj is offline
Registered User
 
Join Date: Mar 2003
Posts: 343
fetch first 10 rows only
Reply With Quote
  #3 (permalink)  
Old 11-17-03, 02:07
yuvensius yuvensius is offline
Registered User
 
Join Date: Nov 2003
Posts: 2
about paging

Quote:
Originally posted by cchattoraj
fetch first 10 rows only
Thanks for your answer, but if i use your statement, i' m just always got first 10 records. But if i have 30 records, and i make paging is mean that i have 3 pages for each page contains record. Now, the problem is how can i know next page with next record within conditional i given?

example :

i have 30 records, and page 1 is contain first 10 record, and page 2 contain 11 - 20 record, and page 3 contain 21 - 30 record. i cannot trace next record to display next page. Maybe you have another solution again....thanks

best regards

yuvensius
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On