db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bruehlicke <bruehli...@gmail.com>
Subject Re: Get auto increment value
Date Tue, 12 Feb 2008 21:45:14 GMT
     Look in the doc for   VALUES IDENTITY_VAL_LOCAL()     this function
gives you the latest ID generated.

B-)


On Feb 12, 2008 3:41 PM, larsk <larsk8@yahoo.se> wrote:

>
> I am making a java-application that uses an apache derby database. One of
> the
> fields in one of the tables has auto increment applied (GENERATED BY
> DEFAULT
> AS IDENTITY). Is it possible to get the value that this field is going to
> get or what value it got when making an insert? Or do I have to make a
> select to the database to know this?
> I use the following code to insert data to the database:
>
> --------------------
>
> Connection con = DriverManager.getConnection(connectionString);
>
> Statement state = con.createStatement();
>
> try
> {
>        state.executeUpdate(queryString);
> }
>
> catch (Exception ex)
> {
>        throw(ex);
> }
>
> con.close();
>
> --------------------
>
> If anyone has any idea on how to make this know I would appreciate any
> help.
> --
> View this message in context:
> http://www.nabble.com/Get-auto-increment-value-tp15443701p15443701.html
> Sent from the Apache Derby Users mailing list archive at Nabble.com.
>
>

Mime
View raw message