pentaho/pentaho-kettle · error · KettleDatabaseException
Unable to prepare combi insert statement : + Const.CR +…
Error message
Unable to prepare combi insert statement : + Const.CR + sqlStatement
What it means
combiInsert builds the INSERT statement for a new junk-dimension row and prepares a JDBC PreparedStatement. SQLException (or any other exception) during preparation is wrapped into a KettleDatabaseException 'Unable to prepare combi insert statement : <sql>'.
Solutions
- Read the cause SQLException and the embedded SQL statement; run it manually against the DB to see the real error
- Create/verify the junk dimension table and required columns
- Grant INSERT privileges to the connection's DB user
- Reconnect the database (retest connection metadata) if the session was dropped
Example fix
-- before: table missing -- KettleDatabaseException: Unable to prepare combi insert statement -- after: create the junk dimension table first CREATE TABLE junk_dim (id BIGINT PRIMARY KEY, hashcode BIGINT, ...);
Defensive patterns
Strategy: retry
Validate before calling
Database db = new Database(parent, databaseMeta);
db.connect();
if (!db.checkTableExists(schemaTable)) {
throw new IllegalStateException("Junk dimension table missing before insert: " + schemaTable);
}
db.disconnect(); Try / catch
try {
trans.execute(null);
trans.waitUntilFinished();
} catch (KettleDatabaseException e) {
log.error("Combi insert prepare failed, SQL: " + e.getMessage(), e);
// inspect cause for INSERT privilege or syntax errors before retrying
} Prevention
- Ensure the DB user has INSERT grants on the junk dimension
- Create the dimension table before the transformation runs
- Log and review the generated SQL statement on failure
When it happens
Trigger: data.db.getConnection().prepareStatement(stripCR(sqlStatement)) throws in combiInsert (called from lookupValues) — invalid SQL, missing table/columns, insufficient INSERT privilege, or a closed connection.
Common situations: Junk dimension table absent (never created); DB user without INSERT grant; datatype mismatch in the generated SQL; connection broken mid-transformation.
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 prepare combi-lookup statement
- SQLFileOutputMeta.Exception.ErrorGettingFields
- The same column can't be inserted into the target row…
- Unable to prepare dimension insert :
- AccessInputMeta.Exception.ErrorSavingToRepository
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/53c3d06c5d2fc13d.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/combinationlookup/CombinationLookup.java:582
}
sql += " )";
String sqlStatement = sql;
try {
debug = "First: prepare statement";
if ( isAutoIncrement() && databaseMeta.supportsAutoGeneratedKeys() ) {
logDetailed( "SQL with return keys: " + sqlStatement );
data.prepStatementInsert =
data.db.getConnection().prepareStatement(
databaseMeta.stripCR( sqlStatement ), Statement.RETURN_GENERATED_KEYS );
} else {
logDetailed( "SQL without return keys: " + sqlStatement );
data.prepStatementInsert =
data.db.getConnection().prepareStatement( databaseMeta.stripCR( sqlStatement ) );
}
} catch ( SQLException ex ) {
throw new KettleDatabaseException( "Unable to prepare combi insert statement : "
+ Const.CR + sqlStatement, ex );
} catch ( Exception ex ) {
throw new KettleDatabaseException( "Unable to prepare combi insert statement : "
+ Const.CR + sqlStatement, ex );
}
}
debug = "Create new insert row rins";
Object[] insertRow = new Object[ data.insertRowMeta.size() ];
int insertIndex = 0;
if ( !isAutoIncrement() ) {
insertRow[ insertIndex ] = val_key;
insertIndex++;
}
if ( meta.useHash() ) {
insertRow[ insertIndex ] = val_crc;
insertIndex++;View on GitHub (pinned to f3058517a1)