The SQL Server driver supports retrieving the values of auto-generated keys. An auto-generated key returned by the SQL Server driver is the value of an identity column.
An application can return values of auto-generated keys when it executes an Insert statement. How you return these values depends on whether you are using an Insert statement that contains parameters:
An application can retrieve values of auto-generated keys using the Statement.getGeneratedKeys() method. This method returns a ResultSet object with a column for each auto-generated key.
Refer to Chapter 5 “Designing JDBC Applications for Performance Optimization” in the
DataDirect Connect Series for JDBC Reference for information about how auto-generated keys can improve performance.