Re: Postgresql JDBC-Driver

From: Kris Jurka <books(at)ejurka(dot)com>
To: Rudolpho Gian-Franco Gugliotta <rudolpho(at)gugliotta(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Postgresql JDBC-Driver
Date: 2004-06-11 00:41:10
Message-ID: Pine.BSO.4.56.0406101936090.24756@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 5 Mar 2004, Rudolpho Gian-Franco Gugliotta wrote:

> Hi,
>
> i'm using the jdbc postgresql driver. I need to fetch the oid of a just
> insertet row
> (getGeneratedKeys() feature). That' why i ask you to provide me the
> source code
> to implement this feature.It would be glad if you tell me how and where
> to get
> these sources.
>

The driver source is included in the main source tree for the 7.4 series,
but for the upcoming 7.5 release the driver is being developed
independently here:
http://gborg.postgresql.org/project/pgjdbc/projdisplay.php

Some discussion of the problems with implementing getGeneratedKeys is
here:
http://archives.postgresql.org/pgsql-jdbc/2003-12/threads.php#00193

Finally you don't necessarily need to implement getGeneratedKeys if you
don't mind using some pg specific code along the lines of the following:

Statement stmt = conn.createStatement();
stmt.executeUpdate("INSERT INTO t VALUES (1)");
long oid = ((org.postgresql.PGStatement)stmt).getLastOID();

Kris Jurka

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2004-06-11 00:54:02 Re: Nested xacts: looking for testers and review
Previous Message Dann Corbit 2004-06-11 00:36:46 Re: [pgsql-hackers-win32] Tablespaces