{"record":{"id":"3253f099e700780a","repo":"pentaho/pentaho-kettle","slug":"error-getting-views-from-schema","errorCode":null,"errorMessage":"Error getting views from schema []","messagePattern":"Error getting views from schema \\[\\]","errorType":"exception","errorClass":"KettleDatabaseException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/database/Database.java","lineNumber":4380,"sourceCode":"          if ( log.isDebug() ) {\n            log.logDebug( \"Error getting views for field TABLE_SCHEM (ignored): \" + e.toString() );\n          }\n        }\n\n        if ( Utils.isEmpty( schema ) ) {\n          schema = cat;\n        }\n\n        String table = allviews.getString( TABLES_META_DATA_TABLE_NAME );\n\n        if ( log.isRowLevel() ) {\n          log.logRowlevel( toString(), \"got view from meta-data: \"\n            + databaseMeta.getQuotedSchemaTableCombination( schema, table ) );\n        }\n        multimapPut( schema, table, viewMap );\n      }\n    } catch ( SQLException e ) {\n      throw new KettleDatabaseException( \"Error getting views from schema [\" + schemaname + \"]\", e );\n    }\n\n    if ( log.isDetailed() ) {\n      log.logDetailed( \"read :\" + multimapSize( viewMap ) + \" views from db meta-data.\" );\n    }\n\n    return viewMap;\n  }\n\n  public String[] getSynonyms() throws KettleDatabaseException {\n    return getSynonyms( false );\n  }\n\n  public String[] getSynonyms( boolean includeSchema ) throws KettleDatabaseException {\n    return getSynonyms( null, includeSchema );\n  }\n\n  public String[] getSynonyms( String schemanamein, boolean includeSchema ) throws KettleDatabaseException {","sourceCodeStart":4362,"sourceCodeEnd":4398,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/database/Database.java#L4362-L4398","documentation":"Thrown when the JDBC DatabaseMetaData.getTables(...) call used to list views fails with a SQLException while iterating or fetching. Kettle wraps it in a KettleDatabaseException naming the schema being read. It means the database rejected the metadata query for views in that schema.","triggerScenarios":"Database.getViews(...) / getTableMap-style call where getDatabaseMetaData().getTables(catalog, schema, \"VIEW\", null) throws during next() — bad schema name pattern, unsupported catalog/schema argument, or metadata query failure.","commonSituations":"Schema name with wrong case on case-sensitive databases (Oracle uppercase, PostgreSQL lowercase); passing a catalog value the driver doesn't accept; insufficient privileges to see views in the schema; driver quirks with null vs empty-string schema argument.","solutions":["Verify the schema name case matches the database convention (Oracle: uppercase, PostgreSQL: lowercase) and pass null for no schema instead of \"\".","Check the DB user has privileges to query the schema's views (e.g. Oracle dictionary access).","Try null instead of empty-string for catalog/schema arguments to let the driver use defaults.","Capture and inspect the chained SQLException (getCause) to see the driver's actual error and fix accordingly."],"exampleFix":"// before\ndb.getViews(false, \"myschema\"); // wrong case on Oracle\n\n// after\ndb.getViews(false, \"MYSCHEMA\"); // correct case for Oracle metadata calls","handlingStrategy":"validation","validationCode":"if (schema != null && schema.isEmpty()) schema = null; // let driver use defaults\n// ensure case matches DB convention: Oracle -> schema.toUpperCase(), PostgreSQL -> toLowerCase()","typeGuard":"boolean schemaUsable(String schema, Database db) {\n  return schema == null || !schema.trim().isEmpty();\n}","tryCatchPattern":"try {\n  views = db.getViews(false, schema);\n} catch (KettleDatabaseException e) {\n  throw new RuntimeException(\"Failed listing views in schema '\" + schema + \"': \" + e.getCause(), e);\n}","preventionTips":["Match schema name case to the database convention","Confirm the DB user can read the schema's metadata","Prefer null over empty string for absent catalog/schema","Always log/print the chained SQLException cause"],"tags":["jdbc","database-metadata","views","schema"],"backgroundTag":"database-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"}