struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Graham" <dgraham1...@hotmail.com>
Subject Re: [OT] RE: Struts and Large ResultSet
Date Tue, 10 Sep 2002 01:56:19 GMT
The databases all have their own version of this feature :-( so in SQL 
Server it's:

select top 10 from table

which makes the most sense to me.  But, in DB2 you use a "fetch first" 
clause like this:

select * from table
fetch first 30 rows only

Here's where I found the info
http://nscpcw.physics.upenn.edu/db2_docs/db2s0/fet1st.htm#HDRFET1ST

I tried it out on a db2 7.2 database on win2k so hopefully it works on 
AS400.

Dave

>From: Ashish Kulkarni <kulkarni_ash1312@yahoo.com>
>Reply-To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
>To: Struts Users Mailing List <struts-user@jakarta.apache.org>
>Subject: Re: [OT] RE: Struts and Large ResultSet
>Date: Mon, 9 Sep 2002 16:02:00 -0700 (PDT)
>
>Hi,
>I am developing an web interface to existing AS400
>system, so there is no way i can go to MYSQL or
>suggest to change database, i have to live with AS400
>and DB2 and try to find a way out
>thanx for suggestion
>
>--- "Peter A. J. Pilgrim"
><peterp@xenonsoft.demon.co.uk> wrote:
> > 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:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> >
>
>
>=====
>A$HI$H
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Finance - Get real-time stock quotes
>http://finance.yahoo.com
>
>--
>To unsubscribe, e-mail:   
><mailto:struts-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: 
><mailto:struts-user-help@jakarta.apache.org>




_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message