pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniele Bufarini <daniele.bufarini@ie-online.it>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [S] Re: Problems with non scrollable cursors
Date: Mon, 24 Jan 2005 10:57:56 +0100
Message-ID: <41F4C6A4.7000309@ie-online.it> (raw)
In-Reply-To: <Pine.BSO.4.56.0501240425000.6854@leary.csoft.net>
References: <41F12F29.5010602@ie-online.it>
	<Pine.BSO.4.56.0501211452120.8058@leary.csoft.net>
	<41F4B798.60408@ie-online.it>
	<Pine.BSO.4.56.0501240425000.6854@leary.csoft.net>

Kris Jurka wrote:

>On Mon, 24 Jan 2005, Daniele Bufarini wrote:
>
>  
>
>>Actually using the cursor multiple time is what I was thinking...
>>In fact, I can keep an open database connection only for large result 
>>set and use a one time connection for all the others.
>>My problem is that I cannot scroll back using a cursor... I'm wondering 
>>If I have to modify the jdbc driver or the back end or if there are 
>>other solutions, less time consuming...
>>    
>>
>
>The easiest thing to do is to forgo parts of the JDBC interface and do it 
>manually.
>
>Statement.execute("DECLARE mycursor SCROLL CURSOR FOR ...");
>
>Then:
>
>Statement.execute("MOVE ABSOLUTE 2000 IN mycursor");
>ResultSet = Statement.executeQuery("FETCH FORWARD 10 FROM mycursor");
>
>
>To fix this in the driver there are two avenues of attack here.  The 7.4
>driver used explicit DECLARE and FETCH calls for cursors.  The driver
>would need to be modified to add a SCROLL keyword and then handle moving
>back and forth.  A patch was produced to do this, which I had some
>concerns about, that the poster never responded to:
>
>http://archives.postgresql.org/pgsql-jdbc/2004-05/msg00164.php
>
>The 8.0 driver has been changed to use protocol level portals which are 
>pretty much the same as cursors.  The problem is that protocol only 
>has support for forward cursors in both declaration and fetching.  To fix 
>things along these lines would require pretty much all of the work in the 
>driver as the 7.4 path, but would also require some backend work and more 
>importantly, convincing people to change the frontend/backend protocol.
>

Thank you very much for your explanations, Kris!
First I'll try to use cursors without the JDBC interface: If that 
shouldn't work as required, I'll consider the two other avenues of attack.
I'll let you know...

                Best regards,
                    Daniele Bufarini.





view thread (5+ messages)

Message-ID: <41F4C6A4.7000309@ie-online.it>
Permalink:  ../41F4C6A4.7000309@ie-online.it/
Also on:    postgresql.org/message-id/41F4C6A4.7000309@ie-online.it

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: daniele.bufarini@ie-online.it, books@ejurka.com
  Subject: Re: [S] Re: Problems with non scrollable cursors
  In-Reply-To: <41F4C6A4.7000309@ie-online.it>
  References: <41F12F29.5010602@ie-online.it> <Pine.BSO.4.56.0501211452120.8058@leary.csoft.net> <41F4B798.60408@ie-online.it> <Pine.BSO.4.56.0501240425000.6854@leary.csoft.net> <41F4C6A4.7000309@ie-online.it>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox