Possible Duplicate:
How to get the insert ID in JDBC?
In the following statement, how can I fetch the last inserted C12 identity value? This is from the JavaDB manual, but they have not mentioned how to retrieve this last inserted value from this record set.
CREATE TABLE TABLE1 (C11 int, C12 int GENERATED ALWAYS AS IDENTITY)
Statement stmt = conn.createStatement();
stmt.execute(
"INSERT INTO TABLE1 (C11) VALUES (1)",
Statement.RETURN_GENERATED_KEYS);
ResultSet rs = stmt.getGeneratedKeys();