Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003

    Wink Unanswered: 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);

    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...

  2. #2
    Join Date
    Mar 2003
    fetch first 10 rows only

  3. #3
    Join Date
    Nov 2003

    about paging

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts