<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2668" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=831305407-05082005><FONT face=Arial color=#0000ff size=2>Hi
Akiro,</FONT></SPAN></DIV>
<DIV><SPAN class=831305407-05082005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=831305407-05082005><FONT face=Arial color=#0000ff
size=2>Issuing a SELECT query in PostgreSQL will always cause the complete
result set to be loaded into memory, so if you need a few records at a time then
you must use a cursor. However, it may be that the PostgreSQL JDBC driver
implicity creates cursors when accessing a data source - you'd need to ask the
PostgreSQL people about this as I don't have enough experience in this area to
know if this is the case or not.</FONT></SPAN></DIV>
<DIV><SPAN class=831305407-05082005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=831305407-05082005><FONT face=Arial color=#0000ff size=2>I
think the first thing you need to do is work out whether this is a PostgreSQL
issue or a PostGIS issue. Firstly, make sure that you have got the latest
versions of the PostgreSQL JDBC driver (<A
href="http://jdbc.postgresql.org">http://jdbc.postgresql.org</A>) and PostGIS
JDBC sources (<A
href="http://postgis.refractions.net">http://postgis.refractions.net</A>). At
the time of writing, this is 8.0 build 312 for PostgreSQL and the JDBC2 drivers
from postgis 1.0.2. Also, it would be useful to find out what version of
PostgreSQL and PostGIS you are using - this can be found by doing SELECT
version() and SELECT postgis_full_version().</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=831305407-05082005><FONT face=Arial color=#0000ff size=2>If the
error still occurs with these drivers, then try and determine whether or not the
same error occurs if you drop the geometry column from both tables. If your
query works without the geometry columns then it's likely a PostGIS issue so
you'll need to let us have a test case in order to fix it. If it still fails
without geometry columns, then it is likely to be a PostgreSQL error. In this
case, I would recommend that you subscribe to pgsql-jdbc list on <A
href="http://www.postgresql.org">www.postgresql.org</A> and point your questions
to the PostgreSQL developers there.</FONT></SPAN></DIV>
<DIV><SPAN class=831305407-05082005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=831305407-05082005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=831305407-05082005><FONT face=Arial color=#0000ff size=2>Kind
regards,</FONT></SPAN></DIV>
<DIV><SPAN class=831305407-05082005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=831305407-05082005><FONT face=Arial color=#0000ff
size=2>Mark.</FONT></SPAN></DIV><!-- Converted from text/plain format -->
<P><FONT size=2>------------------------<BR>WebBased Ltd<BR>17 Research
Way<BR>Tamar Science Park<BR>Plymouth<BR>PL6 8BT<BR><BR>T: +44 (0)1752
797131<BR>F: +44 (0)1752 791023<BR>W: <A
href="http://www.webbased.co.uk/">http://www.webbased.co.uk</A><BR> </FONT>
</P>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>Akira Komo<BR><B>Sent:</B> 04 August 2005 18:26<BR><B>To:</B> PostGIS
Users Discussion<BR><B>Subject:</B> RE: [postgis-users] JDBC
OutofMemoryError<BR><BR></FONT></DIV>
<P>Mark,</P>
<P>Thank you so much for your replying. The real query would be more
complicated with some join condition. I suspect the problem was from
postgresql JDBC driver. You know a JDBC driver has a buffer at client side,
it should not fetch all the records from the server side after
issuing a query, otherwise you are not able to query a database with million
records. It should load the records dynamically when end users go through
the ResultSet by calling ResultSet.next(). In my case, probably at very
beginning, only serveral hundreds records were downloaded to the
JDBC client side. Notice that every record is 1. The OutOfMemoryError
occured just after executing the statement.executeQuery() before
I call Result.next(). </P>
<P>Best Regards</P>
<P>-- Akiro</P></BLOCKQUOTE></BODY></HTML>