db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hong Ji" <hongco...@gmail.com>
Subject Re: How to get the id of the newly inserted record?
Date Sun, 06 Aug 2006 08:40:59 GMT
I use following code to retrieve the id. Although it returns the same and
correct id, the while loop is executed multiple times after multiple rows
are inserted. Is it a bug?

ResultSet rs = statement.executeQuery("select IDENTITY_VAL_LOCAL() from
APP.Students");
while(rs.next())
{
     id = rs.getInt(1);
}


On 7/26/06, Paul J DeCoursey <paul@decoursey.net> wrote:
>
> Hong Ji wrote:
> > With JDBC and Derby, how to get the id of the newly inserted record?
> SELECT IDENTITY_VAL_LOCAL() FROM ...
>
>

Mime
View raw message