Thanks, Kristian. It works now.
Hong Ji wrote:
> I am using a PerparedStatement to insert a record. After the record is
> inserted (after statement.executeUpdate()), I call
> aStatement.getGeneratedKeys() to retrieve the generated id of the new
> record, but it returns a null ResultSet.
> Is getGeneratedKeys() supposed to work with Derby?
Yes, getGeneratedKeys() is supposed to work.
I'm able to retrieve a auto-generated key when doing an INSERT with a
Did you remember to create the PreparedStatement with the correct
You must tell Derby to return the generated keys, or else you will get
an empty ResultSet. Note that Derby does not support the
prepareStatement-methods that take an integer or String array.
Hope this helps,