You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Hong Ji <ho...@gmail.com> on 2006/08/06 10:40:59 UTC

Re: How to get the id of the newly inserted record?

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 <pa...@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 ...
>
>