Returning the last autoincremented key in DB2
SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1
In JDBC:
connection.prepareStatement(sqlStatement, Statement.RETURN_GENERATED_KEYS);
preparedStatement.executeUpdate();
ResultSet rs = preparedStatement.getGeneratedKeys(); // returns one int per row