Re: setFetchSize()

From: Dmitry Tkach <dmitry(at)openratings(dot)com>
To: Rich Cullingford <rculling(at)sysd(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: setFetchSize()
Date: 2003-07-17 17:01:43
Message-ID: 3F16D677.3010300@openratings.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Rich Cullingford wrote:

> All,
> Will this function be implemented in Release 7.4? I have several arge
> tables that run Java out of memory when I attempt to load them through
> JDBC. Any workarounds arppreciated...

I was using cursors for a while as a workaround...
Something like this:

c.setAutocommit (false);
Statement s = c.createStatement ();
s.execute ("declare foo cursor for select * from bar");

while (true)
{
ResultSet rs = s.executeQuery ("fetch 10 from foo");
int count = 0;
while (rs.next ())
{
count++;
doStuffWithThisRow (rs);
}

if (count < 10) //The whole cursor contents has been processed
break;
}


I hope, it helps...

Dima

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Patric Bechtel 2003-07-17 17:11:44 Re: setFetchSize() [Viruschecked]
Previous Message Felipe Schnack 2003-07-17 17:01:10 Re: setFetchSize()