{"record":{"id":"945c3ca8c87799f0","repo":"pentaho/pentaho-kettle","slug":"unable-to-connect-to-logging-database","errorCode":null,"errorMessage":"Unable to connect to logging database [","messagePattern":"Unable to connect to logging database \\[","errorType":"exception","errorClass":"KettleDatabaseException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/TransMeta.java","lineNumber":4675,"sourceCode":"\n            Database db = null;\n            try {\n              db = new Database( this, transLogTable.getDatabaseMeta() );\n              db.shareVariablesWith( this );\n              db.connect();\n\n              RowMetaInterface fields = logTable.getLogRecord( LogStatus.START, null, null ).getRowMeta();\n              String\n                  schemaTable =\n                  logTable.getDatabaseMeta()\n                      .getQuotedSchemaTableCombination( logTable.getSchemaName(), logTable.getTableName() );\n              String sql = db.getDDL( schemaTable, fields );\n              if ( !Utils.isEmpty( sql ) ) {\n                SQLStatement stat = new SQLStatement( \"<this transformation>\", transLogTable.getDatabaseMeta(), sql );\n                stats.add( stat );\n              }\n            } catch ( Exception e ) {\n              throw new KettleDatabaseException(\n                  \"Unable to connect to logging database [\" + logTable.getDatabaseMeta() + \"]\", e );\n            } finally {\n              if ( db != null ) {\n                db.close();\n              }\n            }\n          }\n        }\n      } catch ( KettleDatabaseException dbe ) {\n        SQLStatement stat = new SQLStatement( \"<this transformation>\", transLogTable.getDatabaseMeta(), null );\n        stat.setError(\n            BaseMessages.getString( PKG, \"TransMeta.SQLStatement.ErrorDesc.ErrorObtainingTransformationLogTableInfo\" )\n                + dbe.getMessage() );\n        stats.add( stat );\n      }\n    }\n    if ( monitor != null ) {\n      monitor.worked( 1 );","sourceCodeStart":4657,"sourceCodeEnd":4693,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/TransMeta.java#L4657-L4693","documentation":"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.","triggerScenarios":"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.","commonSituations":"Log database host/port wrong or firewalled; wrong username/password; database driver missing; logging configured in the transformation pointing to a decommissioned DB.","solutions":["Check the chained cause for the real error (UnknownHostException, Connection refused, auth failure)","Test the logging database connection in Spoon's database dialog and fix host/port/credentials","Ensure the JDBC driver jar is on the classpath; disable or repoint the transformation logging table if unneeded"],"exampleFix":"// before\ntransMeta.getSQLStatements(getPackageName(), this); // throws KettleDatabaseException\n// after\nDatabaseMeta logDb = transMeta.getTransLogTable().getDatabaseMeta();\nif (logDb != null && testConnection(logDb)) { transMeta.getSQLStatements(...); }","handlingStrategy":"try-catch","validationCode":"DatabaseMeta logDb = transMeta.getTransLogTable().getDatabaseMeta();\nif (logDb != null) {\n  try (Database db = new Database(transMeta, logDb)) {\n    db.connect(); // fail fast before transformation execution/verification\n    db.disconnect();\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  SQLStatement[] stats = transMeta.getSQLStatements(...).getStatements();\n} catch (KettleDatabaseException e) {\n  logger.error(\"Cannot reach logging database [{}]\", e.getCause() != null ? e.getCause().getMessage() : e.getMessage(), e);\n  // optionally continue without logging tables\n}","preventionTips":["Test the logging DB connection from the deployment host (firewall/DNS differ from dev)","Keep JDBC drivers on the server classpath","Repoint or disable transformation logging when the log database is decommissioned"],"tags":["database","logging","connectivity"],"backgroundTag":"connection-refused","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}