Ashish Kulkarni wrote:
> Hi,
> But is there a way to write some thing, which is
> database independent, so u can change the database
> without any code modification,
> what i am trying it using CachedRowSet, i load the
> resultset into a cachedrowset and then display it page
> by page,
> now only think i have to figure is, how can i load
> only few records in this rowset, like if i have 1
> million records, just load say 1000 records, iterate
> through them, if u reach end of cache load another
> 1000, and so,
> since a user will never go through a process of seeing
> million records at a time, may be 1000 the max...
> most user will use some thing like "Go To" to point at
> a specific record in database,
> I hope this thing works out well
> Ashish


Then you need something like MYSQL which has special
reserved word to help you limit the size of the results.

SELECT LAST_NAME, FIRST_NAME, DEPT FROM COMPANY_EMPLOYEES
    ORDER BY LAST_NAME
    GROUP BY DEPT
    LIMIT <offset>, <number-of-rows>

The "LIMIT" word get you a finite rowset limitation
efficiently on the Database server side. Without this
you may have to read the entire data set out of the
database. Say you only interested in rows 30 to 40
then you discard 30 rows already as in normal JDBC
programming and then kill off the query and result
after reading row 439.  Suppose the database table
has 10000 rows, then the database server may in efficient
allocate the time and memory for 1000 rows to read
by the client. But you stopped on row 40, what
a waste with 960 unused records!

So in a nutshell go with MYSQL

SELECT CASH_IN, CASH_OUT, INVOICE, CUSTOMER
  FROM BOOK_BALANCE
        LIMIT 30, 10

a la google.com

Or I think Oracle my have ROWINDEX attribute.

ROWINDEX >= 30 and ROWINDEX < 40.

Sybase and Postgres I dunno.

-- 
Peter Pilgrim         +-----\ +-++----++----+
Java Technologist     |     | | ||    ||    | 'n' Shine
                       |  O  | | ||  --+| ---+
         /\            | ._  / | | \  \ |    |
        /  \           | | \ \ | |+--  || ---+ A new day
       /_  _\  "Up"    | | | | | ||    ||    | is coming
         ||            +-+ +-+ +-++----++----+
<home page="http://www.xenonsoft.demon.co.uk/"; />


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to