{"record":{"id":"b1364c8f2bb60000","repo":"pentaho/pentaho-kettle","slug":"tableoutputmeta-exception-errorgettingfields","errorCode":"TableOutputMeta.Exception.ErrorGettingFields","errorMessage":"TableOutputMeta.Exception.ErrorGettingFields","messagePattern":"TableOutputMeta\\.Exception\\.ErrorGettingFields","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutputMeta.java","lineNumber":923,"sourceCode":"    String realSchemaName = space.environmentSubstitute( schemaName );\n\n    if ( databaseMeta != null ) {\n      Database db = new Database( loggingObject, databaseMeta );\n      try {\n        db.connect();\n\n        if ( !Utils.isEmpty( realTableName ) ) {\n          // Check if this table exists...\n          if ( db.checkTableExists( realSchemaName, realTableName ) ) {\n            return db.getTableFieldsMeta( realSchemaName, realTableName );\n          } else {\n            throw new KettleException( BaseMessages.getString( PKG, \"TableOutputMeta.Exception.TableNotFound\" ) );\n          }\n        } else {\n          throw new KettleException( BaseMessages.getString( PKG, \"TableOutputMeta.Exception.TableNotSpecified\" ) );\n        }\n      } catch ( Exception e ) {\n        throw new KettleException(\n          BaseMessages.getString( PKG, \"TableOutputMeta.Exception.ErrorGettingFields\" ), e );\n      } finally {\n        db.close();\n      }\n    } else {\n      throw new KettleException( BaseMessages.getString( PKG, \"TableOutputMeta.Exception.ConnectionNotDefined\" ) );\n    }\n\n  }\n\n  public DatabaseMeta[] getUsedDatabaseConnections() {\n    if ( databaseMeta != null ) {\n      return new DatabaseMeta[] { databaseMeta };\n    } else {\n      return super.getUsedDatabaseConnections();\n    }\n  }\n","sourceCodeStart":905,"sourceCodeEnd":941,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutputMeta.java#L905-L941","documentation":"A catch-all wrapper raised inside the TableOutputMeta table-field lookup: any Exception thrown while connecting to the database or reading the target table's metadata (getTableFieldsMeta) is rethrown as a KettleException with this keyed message and the original as cause. It signals the field-introspection operation failed for a reason other than the specific TableNotFound/TableNotSpecified checks.","triggerScenarios":"db.checkTableExists or db.getTableFieldsMeta throws — e.g. JDBC connection failure, SQL error during metadata queries, driver missing — while executing the getTableFields() path on TableOutputMeta.","commonSituations":"Database unreachable (network/firewall), wrong credentials, missing JDBC driver jar in lib/, database permissions insufficient for metadata queries, schema/table names with characters requiring quoting.","solutions":["Inspect the cause chain (getCause()) for the underlying JDBC/SQL error.","Test the database connection in the connection dialog (Test button) to isolate connectivity/credentials.","Ensure the JDBC driver for your database is on the classpath (lib/ or libext/).","Grant the user permission to query metadata (e.g. INFORMATION_SCHEMA / system catalogs) for the target schema."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// verify connectivity and driver before metadata lookup\ntry (Connection c = dbMeta.getConnectionTest()) { /* or use Database.test() */\n  // connection OK\n}","typeGuard":null,"tryCatchPattern":"try { fields = meta.getTableFields(); }\ncatch (KettleException e) {\n  Throwable root = ExceptionUtils.getRootCause(e);\n  log.error(\"Field lookup failed: \" + root, root); // shows real JDBC error\n}","preventionTips":["Test the database connection before deploying transformations","Install the JDBC driver in lib/ and restart Pentaho","Grant metadata-reading privileges to the runtime user"],"tags":["kettle","database","metadata","table-output"],"backgroundTag":"sql-query-failed","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"}