Re: JDBC and fetching the OID of an insert - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: JDBC and fetching the OID of an insert
Date
Msg-id 1032357854.26938.64.camel@inspiron.cramers
Whole thread Raw
In response to JDBC and fetching the OID of an insert  ("Michael Paesold" <mpaesold@gmx.at>)
List pgsql-jdbc
There is or was actually a method in the driver ResultSet.getLastOID
which allowed you to do this.You will have to cast the resultset into a
AbstractJdbc(x)ResultSet, where x is the version; but Daryl's way is
much better since oid's can wrap, and there is a possiblity that they
don't exist ( you can turn them off in postgres).

Dave

On Wed, 2002-09-18 at 09:36, Michael Paesold wrote:
> Hi,
>
> Does anyone of you know, how to get the OID of the just inserted Row after
> stmt.executeUpdate("INSERT... ")? I hope this is possible at all!
>
> If it's not, I would be willing to implement getGeneratedKeys() to return at
> least the OID of an insert. Assuming that would be possible and exceptable?
>
> (Btw. am I correct that the only way to get a value for a sequence via JDBC
> is to "SELECT currval('...')" resp. "SELECT nextval('...')"?)
>
>
> Best Regards,
> Michael
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>




pgsql-jdbc by date:

Previous
From: Daryl Beattie
Date:
Subject: Re: JDBC and fetching the OID of an insert
Next
From: "Michael Paesold"
Date:
Subject: Re: JDBC and fetching the OID of an insert