pentaho/pentaho-kettle · error · KettleDatabaseException
Error getting views from schema []
Error message
Error getting views from schema []
What it means
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.
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.
Example fix
// before db.getViews(false, "myschema"); // wrong case on Oracle // after db.getViews(false, "MYSCHEMA"); // correct case for Oracle metadata calls
Defensive patterns
Strategy: validation
Validate before calling
if (schema != null && schema.isEmpty()) schema = null; // let driver use defaults // ensure case matches DB convention: Oracle -> schema.toUpperCase(), PostgreSQL -> toLowerCase()
Type guard
boolean schemaUsable(String schema, Database db) {
return schema == null || !schema.trim().isEmpty();
} Try / catch
try {
views = db.getViews(false, schema);
} catch (KettleDatabaseException e) {
throw new RuntimeException("Failed listing views in schema '" + schema + "': " + e.getCause(), e);
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Error closing resultset after getting catalogs!
- Error closing resultset after getting schemas!
- Error closing resultset after getting synonyms from schema…
- Error closing resultset after getting views from schema []
- Error getting catalogs!
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/3253f099e700780a.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/database/Database.java:4380
if ( log.isDebug() ) {
log.logDebug( "Error getting views for field TABLE_SCHEM (ignored): " + e.toString() );
}
}
if ( Utils.isEmpty( schema ) ) {
schema = cat;
}
String table = allviews.getString( TABLES_META_DATA_TABLE_NAME );
if ( log.isRowLevel() ) {
log.logRowlevel( toString(), "got view from meta-data: "
+ databaseMeta.getQuotedSchemaTableCombination( schema, table ) );
}
multimapPut( schema, table, viewMap );
}
} catch ( SQLException e ) {
throw new KettleDatabaseException( "Error getting views from schema [" + schemaname + "]", e );
}
if ( log.isDetailed() ) {
log.logDetailed( "read :" + multimapSize( viewMap ) + " views from db meta-data." );
}
return viewMap;
}
public String[] getSynonyms() throws KettleDatabaseException {
return getSynonyms( false );
}
public String[] getSynonyms( boolean includeSchema ) throws KettleDatabaseException {
return getSynonyms( null, includeSchema );
}
public String[] getSynonyms( String schemanamein, boolean includeSchema ) throws KettleDatabaseException {View on GitHub (pinned to f3058517a1)