{"record":{"id":"cffcaffabcbc7226","repo":"pentaho/pentaho-kettle","slug":"error-getting-catalogs","errorCode":null,"errorMessage":"Error getting catalogs!","messagePattern":"Error getting catalogs!","errorType":"exception","errorClass":"KettleDatabaseException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/database/Database.java","lineNumber":4545,"sourceCode":"\n    if ( log.isDetailed() ) {\n      log.logDetailed( \"read :\" + catalogList.size() + \" schemas from db meta-data.\" );\n    }\n\n    return catalogList.toArray( new String[ catalogList.size() ] );\n  }\n\n  public String[] getCatalogs() throws KettleDatabaseException {\n    ArrayList<String> catalogList = new ArrayList<>();\n    ResultSet catalogResultSet = null;\n    try {\n      catalogResultSet = getDatabaseMetaData().getCatalogs();\n      // Grab all the catalog names and put them in an array list\n      while ( catalogResultSet != null && catalogResultSet.next() ) {\n        catalogList.add( catalogResultSet.getString( 1 ) );\n      }\n    } catch ( SQLException e ) {\n      throw new KettleDatabaseException( \"Error getting catalogs!\", e );\n    } finally {\n      try {\n        if ( catalogResultSet != null ) {\n          catalogResultSet.close();\n        }\n      } catch ( SQLException e ) {\n        throw new KettleDatabaseException( \"Error closing resultset after getting catalogs!\", e );\n      }\n    }\n\n    if ( log.isDetailed() ) {\n      log.logDetailed( \"read :\" + catalogList.size() + \" catalogs from db meta-data.\" );\n    }\n\n    return catalogList.toArray( new String[ catalogList.size() ] );\n  }\n\n  public String[] getProcedures() throws KettleDatabaseException {","sourceCodeStart":4527,"sourceCodeEnd":4563,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/database/Database.java#L4527-L4563","documentation":"Thrown when DatabaseMetaData.getCatalogs() fails or iterating its ResultSet raises a SQLException. Kettle wraps it as \"Error getting catalogs!\" in a KettleDatabaseException. It means the catalog (database) listing metadata request was rejected or failed.","triggerScenarios":"Database.getCatalogs() call where getDatabaseMetaData().getCatalogs() throws during execution or next() — unsupported catalog concept on the DBMS, broken connection, or insufficient privileges.","commonSituations":"Calling getCatalogs on drivers that don't implement it correctly (older MySQL/Oracle treats catalog as schema); connection dropped; driver/DB version mismatch; permissions on system catalogs.","solutions":["Update the JDBC driver to one that fully implements getCatalogs for your DBMS.","Skip catalog enumeration when the DBMS doesn't support catalogs (check databaseMeta.supportsCatalogs()).","Verify connection liveness and reconnect if needed.","Read the chained SQLException (getCause) for the driver's exact failure reason."],"exampleFix":"// before\nString[] catalogs = db.getCatalogs(); // on DBMS without catalog support\n\n// after\nif (db.getDatabaseMeta().supportsCatalogs()) {\n  String[] catalogs = db.getCatalogs();\n}","handlingStrategy":"validation","validationCode":"if (db.getDatabaseMeta().supportsCatalogs()) { catalogs = db.getCatalogs(); } else { catalogs = new String[0]; }","typeGuard":null,"tryCatchPattern":"try {\n  catalogs = db.getCatalogs();\n} catch (KettleDatabaseException e) {\n  log.warn(\"Catalog listing failed: \" + e.getCause());\n  catalogs = new String[0];\n}","preventionTips":["Only call getCatalogs when the DBMS/driver supports catalogs","Update JDBC drivers that poorly implement getCatalogs","Verify privileges on system catalogs","Check connection liveness before the call"],"tags":["jdbc","database-metadata","catalogs"],"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"}