Re: setFetchSize()

From: Dmitry Tkach <dmitry(at)openratings(dot)com>
To: Felipe Schnack <felipes(at)ritterdosreis(dot)br>
Cc: Rich Cullingford <rculling(at)sysd(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: setFetchSize()
Date: 2003-07-17 17:41:27
Message-ID: 3F16DFC7.3090305@openratings.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Felipe Schnack wrote:

> Yes, I understand that... that's why I asked why the JDBC driver doesn't automatically use cursos when you have autocommit off and a fetch size
>
>
Because it was never implemented, I suppose...
Here is what 7.3 code looks like:

public void setFetchSize(int rows) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}

:-)

Dima

>On Thu, 17 Jul 2003 13:25:56 -0400
>Dmitry Tkach <dmitry(at)openratings(dot)com> wrote:
>
>
>
>>Felipe Schnack wrote:
>>
>>
>>
>>> but I said I can't understand it when autocommit is off, not when it's on...
>>>
>>>
>>>
>>autocommit is off == you are in transaction.
>>
>>You must be in transaction to be able to declare a cursor.
>>
>>Dima
>>
>>
>>
>>>On Thu, 17 Jul 2003 13:16:15 -0400
>>>Dmitry Tkach <dmitry(at)openratings(dot)com> wrote:
>>>
>>>
>>>
>>>
>>>
>>>>Felipe Schnack wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>Seems to me like a quite good solution! But why this is needed when autocommit is off? I can't understand.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>Because you can only have cursors declared inside a transaction :-(
>>>>
>>>>Dima
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>On Thu, 17 Jul 2003 13:01:43 -0400
>>>>>Dmitry Tkach <dmitry(at)openratings(dot)com> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>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
>>>>>>
>>>>>>
>>>>>>
>>>>>>---------------------------(end of broadcast)---------------------------
>>>>>>TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 2: you can get off all lists at once with the unregister command
>> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>>
>>
>
>
>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2003-07-17 17:47:52 Re: Fix for using JDK1.2 instead of JDK1.4 method in
Previous Message Patric Bechtel 2003-07-17 17:34:51 Re: setFetchSize() [Viruschecked] [Viruschecked]