You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mohammed Zabin <jo...@gmail.com> on 2007/07/09 09:10:26 UTC

Paging

Hi All

I want to ask about ResultSet paging. I mean, displaying your records on
multiple of pages instead of dumping them all in one page.
In ASP using ADO 2, there is a property called page size, when you set the
property, your recordset will determine how many page your recordset will be
displayed.

My questiion is, how could i implement paging using JDBC, is there such
property in JDBC?

Thank You

Re: [OT] Paging

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

David Smith wrote:
> There's no JDBC setting.

Sure there is: Statement.setFetchSize(int size)
"Gives the JDBC driver a hint as to the number of rows that should be
fetched from the database when more rows are needed. The number of rows
specified affects only result sets created using this statement. If the
value specified is zero, then the hint is ignored. The default value is
zero."
http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html#setFetchSize(int)

Mohammed,

While JDBC supports sending results in certain-sized chunks, you should
evaluate how you actually want to do your paging. If you leave a
connection open between requests to allow the JDBC-based paging to
(maybe) help out, then you will be putting a resource strain on your
server since you'll have to leave connections open for a long time,
bound to a certain user or session.

> I'd recommend you take a close look at the
> SELECT statement for your database for syntax to support paging.

This is a better idea. Instead of issuing a single SELECT and then
paging through the results, issue the same SELECT multiple times (once
per page) and then instruct the server to return only results X through
Y. Most RDBMSs support requests for subsets or results (for instance, in
MySQL, you use the LIMIT keyword).

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGkmJT9CaO5/Lv0PARAkeEAJ4zXuYF+86uI9jRs3Gquu5P+yshkACfaBpV
eD6YGnFK87y96eyoltJdIIA=
=lplq
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Paging

Posted by David Smith <dn...@cornell.edu>.
There's no JDBC setting.  I'd recommend you take a close look at the 
SELECT statement for your database for syntax to support paging.

--David

Mohammed Zabin wrote:
> Hi All
>
> I want to ask about ResultSet paging. I mean, displaying your records on
> multiple of pages instead of dumping them all in one page.
> In ASP using ADO 2, there is a property called page size, when you set 
> the
> property, your recordset will determine how many page your recordset 
> will be
> displayed.
>
> My questiion is, how could i implement paging using JDBC, is there such
> property in JDBC?
>
> Thank You
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org