apache/seatunnel · error · SeaTunnelException

Failed to querySQLResult

Error message

Failed to querySQLResult

What it means

OceanBaseOracleCatalog.tableExists wraps SQLException from querying the table-existence SQL into SeaTunnelException("Failed to querySQLResult"). It indicates the metadata probe query against the OceanBase Oracle tenant failed (connectivity, SQL error, bad URL mapping), not that the table is missing.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/oceanbase/OceanBaseOracleCatalog.java:63

    @Override
    protected String getListDatabaseSql() {
        throw new UnsupportedOperationException();
    }

    @Override
    protected String getDatabaseWithConditionSql(String databaseName) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean tableExists(TablePath tablePath) throws CatalogException {
        try {
            return querySQLResultExists(
                    this.getUrlFromDatabaseName(tablePath.getDatabaseName()),
                    getTableWithConditionSql(tablePath));
        } catch (SQLException e) {
            throw new SeaTunnelException("Failed to querySQLResult", e);
        }
    }

    @Override
    public List<String> listTables(String databaseName)
            throws CatalogException, DatabaseNotExistException {
        String dbUrl = getUrlFromDatabaseName(databaseName);
        try {
            return queryString(dbUrl, getListTableSql(databaseName), this::getTableName);
        } catch (Exception e) {
            throw new CatalogException(
                    String.format("Failed listing database in catalog %s", catalogName), e);
        }
    }

    @Override
    public void createTable(
            TablePath tablePath, CatalogTable table, boolean ignoreIfExists, boolean createIndex)

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify JDBC connectivity with the same URL/credentials using a SQL client
  2. Check getUrlFromDatabaseName output for the table's database name is a valid Oracle-thin URL
  3. Inspect the chained SQLException cause for the real error (ORA- code)
  4. Enable connection retry/timeout tuning for unstable networks

Example fix

// before
try { catalog.tableExists(path); } catch (Exception e) { /* opaque */ }
// after
try { catalog.tableExists(path); } catch (SeaTunnelException e) {
    log.error("tableExists failed: {}", e.getCause(), e); // inspect SQLException cause
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check connectivity
try (Connection c = DriverManager.getConnection(url, user, pwd)) { c.isValid(5); }

Try / catch

try { catalog.tableExists(path); } catch (SeaTunnelException e) { Throwable cause = e.getCause(); /* SQLException — inspect and decide retry vs config fix */ }

Prevention

When it happens

Trigger: tableExists(TablePath) executing getTableWithConditionSql via querySQLResultExists when the JDBC connection fails or the query errors; also triggered indirectly by createTable, which calls tableExists first.

Common situations: Wrong tenant/username/password, unreachable OceanBase OBProxy, malformed URL returned by getUrlFromDatabaseName, network/firewall issues.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


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