{"record":{"id":"34da055f29170955","repo":"apache/seatunnel","slug":"failed-listing-table-in-catalog-s","errorCode":null,"errorMessage":"Failed listing table in catalog %s","messagePattern":"Failed listing table 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/dm/DamengCatalog.java","lineNumber":217,"sourceCode":"    public List<String> listTables(String databaseName)\n            throws CatalogException, DatabaseNotExistException {\n        if (!databaseExists(databaseName)) {\n            throw new DatabaseNotExistException(this.catalogName, databaseName);\n        }\n\n        try (PreparedStatement ps =\n                        getConnection(defaultUrl)\n                                .prepareStatement(\"SELECT OWNER, TABLE_NAME FROM ALL_TABLES\");\n                ResultSet rs = ps.executeQuery()) {\n\n            List<String> tables = new ArrayList<>();\n            while (rs.next()) {\n                tables.add(rs.getString(1) + \".\" + rs.getString(2));\n            }\n\n            return tables;\n        } catch (Exception e) {\n            throw new CatalogException(\n                    String.format(\"Failed listing table in catalog %s\", catalogName), e);\n        }\n    }\n\n    @Override\n    public CatalogTable getTable(String sqlQuery) throws SQLException {\n        Connection defaultConnection = getConnection(defaultUrl);\n        return CatalogUtils.getCatalogTable(defaultConnection, sqlQuery, new DmdbTypeMapper());\n    }\n}\n","sourceCodeStart":199,"sourceCodeEnd":228,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/dm/DamengCatalog.java#L199-L228","documentation":"DamengCatalog.listTables wraps any failure during the ALL_TABLES query (connection problems, SQL errors, driver issues) in a CatalogException with message 'Failed listing table in catalog <catalog>'. The cause Exception holds the database-level detail.","triggerScenarios":"The SELECT OWNER, TABLE_NAME FROM ALL_TABLES query fails: connection dropped, permission denied on ALL_TABLES, driver/JDBC URL misconfiguration, or errors while iterating the ResultSet.","commonSituations":"User lacking privileges to read ALL_TABLES; network/firewall dropping the connection; wrong JDBC URL or driver class in catalog config; Dameng server restarted mid-operation.","solutions":["Inspect the cause exception for the real JDBC error (privileges, connectivity, syntax)","Grant the catalog user SELECT privileges on ALL_TABLES (or use a more privileged account)","Verify defaultUrl and driverClass configuration for the Dameng instance","Add retry logic for transient connection failures"],"exampleFix":"// before\nList<String> tables = catalog.listTables(db); // may throw CatalogException\n// after\ntry {\n    List<String> tables = catalog.listTables(db);\n} catch (CatalogException e) {\n    LOG.warn(\"listTables failed for db {}\", db, e.getCause());\n    throw e;\n}","handlingStrategy":"retry","validationCode":"// Java\n// Preflight connection check\ntry (java.sql.Connection c = java.sql.DriverManager.getConnection(defaultUrl, user, pwd)) {\n    c.isValid(5);\n}","typeGuard":null,"tryCatchPattern":"// Java\ntry {\n    return catalog.listTables(databaseName);\n} catch (CatalogException e) {\n    if (e.getCause() instanceof java.sql.SQLException && isTransient(e.getCause())) {\n        return retryWithBackoff(() -> catalog.listTables(databaseName));\n    }\n    throw e;\n}","preventionTips":["Grant the catalog user read access to ALL_TABLES","Validate JDBC URL and driverClass configuration for Dameng before running","Retry transient connection failures with backoff","Monitor database availability; restarts mid-query surface as this exception"],"tags":["jdbc","dameng","catalog-exception","query"],"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"}