{"record":{"id":"88c0f85cdc399759","repo":"apache/seatunnel","slug":"failed-listing-database-in-catalog-s-88c0f8","errorCode":null,"errorMessage":"Failed listing database in catalog %s","messagePattern":"Failed listing database in catalog (.+?)","errorType":"exception","errorClass":"CatalogException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/saphana/SapHanaCatalog.java","lineNumber":160,"sourceCode":"        return String.format(\n                \"SELECT VIEW_NAME FROM SYS.VIEWS WHERE SCHEMA_NAME = '%s'\", databaseName);\n    }\n\n    public String getListSynonymSql(String databaseName) {\n        return String.format(\n                \"SELECT SYNONYM_NAME FROM SYNONYMS WHERE SCHEMA_NAME = '%s'\", databaseName);\n    }\n\n    public List<String> listSynonym(String databaseName)\n            throws CatalogException, DatabaseNotExistException {\n        if (!databaseExists(databaseName)) {\n            throw new DatabaseNotExistException(this.catalogName, databaseName);\n        }\n        String dbUrl = getUrlFromDatabaseName(databaseName);\n        try {\n            return queryString(dbUrl, getListSynonymSql(databaseName), this::getTableName);\n        } catch (Exception e) {\n            throw new CatalogException(\n                    String.format(\"Failed listing database in catalog %s\", catalogName), e);\n        }\n    }\n\n    @Override\n    protected String getTableName(ResultSet rs) throws SQLException {\n        return rs.getString(1);\n    }\n\n    @Override\n    protected String getSelectColumnsSql(TablePath tablePath) {\n        return String.format(\n                SELECT_COLUMNS_SQL_TEMPLATE, tablePath.getDatabaseName(), tablePath.getTableName());\n    }\n\n    @Override\n    public boolean tableExists(TablePath tablePath) throws CatalogException {\n        try {","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/saphana/SapHanaCatalog.java#L142-L178","documentation":"SapHanaCatalog.listSynonym wraps any exception from queryString(getListSynonymSql(...)) into CatalogException(\"Failed listing database in catalog %s\"). Despite the wording, the failing operation is the SYNONYMS metadata query; the real cause is chained.","triggerScenarios":"listSynonym(databaseName) (also reached via getTable synonym resolution) when the query SELECT SYNONYM_NAME FROM SYNONYMS WHERE SCHEMA_NAME='...' fails — connection drop, SQL error, or permissions.","commonSituations":"User without SELECT on SYS.SYNONYMS, wrong tenant, quoting issues in schema name embedded into the SQL, transient network failures.","solutions":["Inspect the chained cause for the underlying SQLException","Grant the connection user access to the SYNONYMS system view","Sanitize/quote the schema name to avoid malformed SQL","Retry transient failures; verify tenant connectivity"],"exampleFix":"// before\nList<String> synonyms = catalog.listSynonym(schema); // CatalogException\n// after\ntry { List<String> synonyms = catalog.listSynonym(schema); } catch (CatalogException e) {\n    log.error(\"listSynonym({}) failed: {}\", schema, e.getCause());\n}","handlingStrategy":"try-catch","validationCode":"// verify metadata access first\n// SELECT COUNT(*) FROM SYS.SYNONYMS WHERE SCHEMA_NAME = ?","typeGuard":null,"tryCatchPattern":"try { catalog.listSynonym(schema); } catch (CatalogException e) { log.error(\"listSynonym failed: {}\", e.getCause()); /* inspect SQLException */ }","preventionTips":["Grant the connection user SELECT on the SYNONYMS system view","Retry transient connection failures with backoff","Sanitize/quote schema names interpolated into the synonym query"],"tags":["jdbc","saphana","sql","metadata"],"backgroundTag":"database-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}