Subject Re: Rép. : [Firebird-Java] return ID after insert??
Author nagypapi
JDBC possibly supports this (haven't tried it out yet though)
take a look at java.sql.Statement.executeUpdate(String sql, int
autoGeneratedKeys) maybe it works :)

--- In Firebird-Java@yahoogroups.com, "Maciek BOROWKA" <MBO@c...> wrote:
> No. (As far as I know). The correct method to get the desired result
> is to set up a generator (you need it anyway) and get the generated
> ID BEFORE inserting the record:
> ====
> rs = p.executeQuery("select gen_id(" + generatorName + ", 1) from
rdb$database");
> rs.next();
> int res = rs.getInt(1);
> //use res to insert the record
> ====
> BTW, this is much cleaner that the microsoftish "SELECT :res =
@@identity;" hack, IMO.
> And it works in a multi-threaded environnement :+)
>
> ./Maciek
>
>
>
> >>> richard@d... 11/01/04 13h33 >>>
>
> Hi guy's and girl's,...
>
> Is there a way to get back the id of a record that just has been
> inserted,... with java..??
>
> gteerz
>
>
>
> Richard Drent
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/Firebird-Java/
>
> To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/