pentaho/pentaho-kettle · error · KettleDatabaseException

Unable to connect to logging database [

Error message

Unable to connect to logging database [

What it means

While checking/generating DDL for transformation logging tables (in suggest/sync logging table code paths), any exception talking to the logging database is wrapped in KettleDatabaseException with message 'Unable to connect to logging database [<dbMeta>]'. The root cause (connection failure, bad SQL, auth) is chained as the cause.

Solutions

  1. Check the chained cause for the real error (UnknownHostException, Connection refused, auth failure)
  2. Test the logging database connection in Spoon's database dialog and fix host/port/credentials
  3. Ensure the JDBC driver jar is on the classpath; disable or repoint the transformation logging table if unneeded

Example fix

// before
transMeta.getSQLStatements(getPackageName(), this); // throws KettleDatabaseException
// after
DatabaseMeta logDb = transMeta.getTransLogTable().getDatabaseMeta();
if (logDb != null && testConnection(logDb)) { transMeta.getSQLStatements(...); }
Defensive patterns

Strategy: try-catch

Validate before calling

DatabaseMeta logDb = transMeta.getTransLogTable().getDatabaseMeta();
if (logDb != null) {
  try (Database db = new Database(transMeta, logDb)) {
    db.connect(); // fail fast before transformation execution/verification
    db.disconnect();
  }
}

Try / catch

try {
  SQLStatement[] stats = transMeta.getSQLStatements(...).getStatements();
} catch (KettleDatabaseException e) {
  logger.error("Cannot reach logging database [{}]", e.getCause() != null ? e.getCause().getMessage() : e.getMessage(), e);
  // optionally continue without logging tables
}

Prevention

When it happens

Trigger: Calling TransMeta methods that verify or auto-create log tables (e.g. during getSQLStatements / transformation verification) when the log table's DatabaseMeta points to an unreachable, misconfigured, or unauthorized database.

Common situations: Log database host/port wrong or firewalled; wrong username/password; database driver missing; logging configured in the transformation pointing to a decommissioned DB.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/945c3ca8c87799f0. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/TransMeta.java:4675

            Database db = null;
            try {
              db = new Database( this, transLogTable.getDatabaseMeta() );
              db.shareVariablesWith( this );
              db.connect();

              RowMetaInterface fields = logTable.getLogRecord( LogStatus.START, null, null ).getRowMeta();
              String
                  schemaTable =
                  logTable.getDatabaseMeta()
                      .getQuotedSchemaTableCombination( logTable.getSchemaName(), logTable.getTableName() );
              String sql = db.getDDL( schemaTable, fields );
              if ( !Utils.isEmpty( sql ) ) {
                SQLStatement stat = new SQLStatement( "<this transformation>", transLogTable.getDatabaseMeta(), sql );
                stats.add( stat );
              }
            } catch ( Exception e ) {
              throw new KettleDatabaseException(
                  "Unable to connect to logging database [" + logTable.getDatabaseMeta() + "]", e );
            } finally {
              if ( db != null ) {
                db.close();
              }
            }
          }
        }
      } catch ( KettleDatabaseException dbe ) {
        SQLStatement stat = new SQLStatement( "<this transformation>", transLogTable.getDatabaseMeta(), null );
        stat.setError(
            BaseMessages.getString( PKG, "TransMeta.SQLStatement.ErrorDesc.ErrorObtainingTransformationLogTableInfo" )
                + dbe.getMessage() );
        stats.add( stat );
      }
    }
    if ( monitor != null ) {
      monitor.worked( 1 );

View on GitHub (pinned to f3058517a1)