pentaho/pentaho-kettle · error · KettleDatabaseException
Unable to retrieve auto-increment of combi insert key : +…
Error message
Unable to retrieve auto-increment of combi insert key : + meta.getTechnicalKeyField()
What it means
KettleDatabaseException wrapping a SQLException raised while calling keys.getLong(1)/getGeneratedKeys() in combiInsert — i.e. the JDBC driver itself threw while trying to retrieve the auto-increment value of the just-inserted combi (dimension) row, as opposed to simply getting no rows back.
Solutions
- Inspect the wrapped SQLException cause; if it is 'feature not supported', switch tech key creation from auto-increment to sequence or table-maximum in the step settings.
- Upgrade or correct the JDBC driver for your database.
- Verify the database connection is still alive (network/firewall timeouts).
- Avoid using getGeneratedKeys-requiring drivers with this step; use a sequence-based key.
Example fix
// before: 'use autoinc' checked with a driver lacking generated-keys support // after: uncheck auto-increment and select 'use table maximum' / a named sequence // for the technical key in the CombinationLookup step dialog.
Defensive patterns
Strategy: try-catch
Validate before calling
// verify driver supports generated keys before relying on autoinc
// DatabaseMetaData md = conn.getMetaData();
// log.info("Driver: " + md.getDatabaseProductName() + " " + md.getDriverVersion()); Try / catch
try { /* run */ } catch (KettleDatabaseException e) {
if (e.getCause() instanceof SQLException) {
log.error("Generated key retrieval failed: " + e.getCause().getMessage());
}
} Prevention
- Validate driver support for RETURN_GENERATED_KEYS in a smoke test.
- Use sequence-based tech keys on Oracle/PostgreSQL instead of autoinc.
- Monitor connection health to avoid mid-statement breakage.
When it happens
Trigger: After the combi insert, data.prepStatementInsert.getGeneratedKeys() or iterating the keys ResultSet throws SQLException; the catch block rethrows with the technical key field name and the SQL exception as cause.
Common situations: Driver does not support generated keys and throws instead of returning an empty set; connection lost between insert and key retrieval; statement closed or feature not implemented by the JDBC driver.
Understand the failure class
Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.
Related errors
- Unable to retrieve auto-increment of combi insert key : +…
- An error occurred executing SQL:
- An error occurred executing SQL:
- Couldn't execute SQL:
- Couldn't find any rows because of an error :
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/5458e88bc5480852.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/combinationlookup/CombinationLookup.java:634
// INSERT NEW VALUE!
data.db.setValues( data.insertRowMeta, insertRow, data.prepStatementInsert );
debug = "Insert row";
data.db.insertRow( data.prepStatementInsert );
debug = "Retrieve key";
if ( isAutoIncrement() && databaseMeta.supportsAutoGeneratedKeys() ) {
ResultSet keys = null;
try {
keys = data.prepStatementInsert.getGeneratedKeys(); // 1 key
if ( keys.next() ) {
val_key = new Long( keys.getLong( 1 ) );
} else {
throw new KettleDatabaseException( "Unable to retrieve auto-increment of combi insert key : "
+ meta.getTechnicalKeyField() + ", no fields in resultset" );
}
} catch ( SQLException ex ) {
throw new KettleDatabaseException( "Unable to retrieve auto-increment of combi insert key : "
+ meta.getTechnicalKeyField(), ex );
} finally {
try {
if ( keys != null ) {
keys.close();
}
} catch ( SQLException ex ) {
throw new KettleDatabaseException( "Unable to retrieve auto-increment of combi insert key : "
+ meta.getTechnicalKeyField(), ex );
}
}
}
} catch ( Exception e ) {
logError( Const.getStackTracker( e ) );
throw new KettleDatabaseException( "Unexpected error in combination insert in part ["
+ debug + "] : " + e.toString(), e );
}
View on GitHub (pinned to f3058517a1)