Home > Archive > PostgreSQL JDBC > July 2005 > Re: getMoreResults() issue









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: getMoreResults() issue
Oliver Jowett

2005-07-25, 8:29 pm

Les Carter wrote:
> This is a multi-part message in MIME format. --bound1122277206
> Content-Type: text/html; charset=o-8859-1 Content-Transfer-Encoding:
> quoted-printable


Your mail client seems to be a bit confused there; I don't see any MIME
headers in the mail header itself.

> Has anyone else managed to get
> Statement.getMoreResults() working with the JDBC3 drivers and Postgres
> 8? It's always coming back as false for me even though I know there's
> more data.


getMoreResults() returns false if either there are no more results, or
the next result is an update count. You must also check getUpdateCount()
to work out if you've run out of results or not. See the javadoc for
details.

As far as I know, getMoreResults() in the current driver works just fine.

> Has anyone got a working example?


I posted an example to the list recently -- check the archives
(archives.postgresql.org).

> Does this method only work for PreparedStatements or does a regular
> Statement also bring back large numbers of rows from the DB in pages?


getMoreResults() has nothing to do with "paging" large result sets, it's
to do with retriving multiple resultsets from a query that has many
statements -- e.g. "SELECT * FROM foo; SELECT * FROM bar; INSERT INTO
baz(1,2,3)" will return two resultsets and an update count.

If you want to retrieve a large resultset incrementally:

- use a TYPE_FORWARD_ONLY resultset
- ensure autocommit is off
- set a non-zero fetchsize

and the driver will do the rest transparently, fetching data in blocks
behind the scenes.

-O

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com