apache/seatunnel · error · CatalogException

Failed listing table in catalog %s

Error message

Failed listing table in catalog %s

What it means

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.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/dm/DamengCatalog.java:217

    public List<String> listTables(String databaseName)
            throws CatalogException, DatabaseNotExistException {
        if (!databaseExists(databaseName)) {
            throw new DatabaseNotExistException(this.catalogName, databaseName);
        }

        try (PreparedStatement ps =
                        getConnection(defaultUrl)
                                .prepareStatement("SELECT OWNER, TABLE_NAME FROM ALL_TABLES");
                ResultSet rs = ps.executeQuery()) {

            List<String> tables = new ArrayList<>();
            while (rs.next()) {
                tables.add(rs.getString(1) + "." + rs.getString(2));
            }

            return tables;
        } catch (Exception e) {
            throw new CatalogException(
                    String.format("Failed listing table in catalog %s", catalogName), e);
        }
    }

    @Override
    public CatalogTable getTable(String sqlQuery) throws SQLException {
        Connection defaultConnection = getConnection(defaultUrl);
        return CatalogUtils.getCatalogTable(defaultConnection, sqlQuery, new DmdbTypeMapper());
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the cause exception for the real JDBC error (privileges, connectivity, syntax)
  2. Grant the catalog user SELECT privileges on ALL_TABLES (or use a more privileged account)
  3. Verify defaultUrl and driverClass configuration for the Dameng instance
  4. Add retry logic for transient connection failures

Example fix

// before
List<String> tables = catalog.listTables(db); // may throw CatalogException
// after
try {
    List<String> tables = catalog.listTables(db);
} catch (CatalogException e) {
    LOG.warn("listTables failed for db {}", db, e.getCause());
    throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

// Java
// Preflight connection check
try (java.sql.Connection c = java.sql.DriverManager.getConnection(defaultUrl, user, pwd)) {
    c.isValid(5);
}

Try / catch

// Java
try {
    return catalog.listTables(databaseName);
} catch (CatalogException e) {
    if (e.getCause() instanceof java.sql.SQLException && isTransient(e.getCause())) {
        return retryWithBackoff(() -> catalog.listTables(databaseName));
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/34da055f29170955. Report an issue: GitHub.