Re: JDBC and positioned updates

From: Hédi HACHENI <hacheni(at)kopileft(dot)com>
To: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC and positioned updates
Date: 2015-12-26 08:01:01
Message-ID: 567E493D.7050204@kopileft.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi,

We cannot use the updatable result set technique since we support
multiple databases so we want to use the AINSI syntax with the CURRENT
OF cursor_name.

We tried to implement the java.sql.Statement#*setCursorName*(String) and
the java.sql.ResultSet#*getCursorName*() methods so that we can set the
cursor name of an SQL statement. But, it seems to be more complicated
than that we expected since the database server always says *"cursor
"name" does not exist**"

*What we did is to change a little bit the implementation of the
*org.postgresql.core.v3.QueryExecutorImpl *in a way that we can define a
cursor name for an SQL statement. We tried to inject this in the
*org.postgresql.core.v3.Portal *class but we did not succeed.

Any ideas ?

Best regards

On 12/25/2015 04:38 PM, Vladimir Sitnikov wrote:
> 1) Have you considered using "updatable ResultSet"?
>
> Here's a sample:
> https://github.com/pgjdbc/pgjdbc/blob/32f513370306529005cb36d968f8e415f4a88aec/pgjdbc/src/test/java/org/postgresql/test/jdbc2/UpdateableResultTest.java#L301-L303
>
> 2) > WHERE CURRENT OF cursor_name
>
> ResultSet implementation fetches result rows in batches, thus "current
> of" at the database side might point to a slightly different row than
> ResultSet at the java side.
>
> 3) You do not expect high throughput of that kind of API, do you?
> Updatable ResultSet is not using batching, so each update would result
> in a database roundtrip.
>
> Vladimir

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vladimir Sitnikov 2015-12-26 08:04:00 Re: JDBC and positioned updates
Previous Message Vladimir Sitnikov 2015-12-25 15:38:49 Re: JDBC and positioned updates