apache/seatunnel · critical · DatabendConnectorException

CONNECT_FAILED

CONNECT_FAILED

Error message

Failed to open Databend source reader: ${e.getMessage()}

What it means

DatabendSourceReader.open() establishes the JDBC connection, runs the configured query (or initial type-check query), and positions the reader. Any exception during this startup — connection failure, bad credentials, invalid SQL — is wrapped in DatabendConnectorException(CONNECT_FAILED) with the original message. The reader cannot start and the source task fails.

Source

Thrown at seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/source/DatabendSourceReader.java:119

            // if rowType is null or empty, infer it from ResultSet metadata
            if (rowType == null || rowType.getFieldNames().length == 0) {
                log.info("Row type is null or empty, inferring from ResultSet metadata");
                rowType = inferRowTypeFromResultSet(resultSet.getMetaData());
                log.info("Inferred row type: {}", rowType);
            } else {
                log.info("Using provided row type: {}", rowType);
            }

            hasNext = resultSet.next();
            log.info("Initial resultSet.next() returned: {}", hasNext);
            if (!hasNext) {
                log.info("No data found in result set");
                reachEnd = true;
            }

        } catch (Exception e) {
            log.error("Error while opening Databend source reader", e);
            throw new DatabendConnectorException(
                    DatabendConnectorErrorCode.CONNECT_FAILED,
                    "Failed to open Databend source reader: " + e.getMessage(),
                    e);
        }
        log.info("DatabendSourceReader opened successfully");
    }

    public SeaTunnelRowType getRowType() {
        return this.rowType;
    }

    @Override
    public void internalPollNext(Collector<SeaTunnelRow> output) throws Exception {
        if (reachEnd) {
            return;
        }

        log.info("Starting to poll data from Databend");

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the JDBC URL host, port, and that Databend is reachable (test with a client or ping/telnet).
  2. Check username/password and that the account can access the target database.
  3. Run the configured sql/query directly against Databend to catch SQL or missing-table errors.
  4. Read the chained 'Caused by' for the precise driver-level failure.
  5. Increase connection timeouts if the network is slow/unreliable.

Example fix

// before: wrong port, connection refused
url = "jdbc:databend://localhost:8123"
// after: correct Databend query port
url = "jdbc:databend://localhost:8000"
Defensive patterns

Strategy: retry

Validate before calling

// preflight connectivity before launching the job
try (Connection c = DriverManager.getConnection(jdbcUrl, user, pass)) {
    try (Statement s = c.createStatement();
         ResultSet rs = s.executeQuery("SELECT 1")) {
        rs.next();
    }
}

Try / catch

try {
    // run the job
} catch (DatabendConnectorException e) {
    if (e.getMessage().startsWith("Failed to open Databend source reader:")) {
        // backoff and retry; check e.getCause() for auth vs network vs SQL error
    } else throw e;
}

Prevention

When it happens

Trigger: open() executes DriverManager/connection setup or the initial query and any Exception occurs: unknown host, refused connection, auth failure, database/table not found, or invalid SQL from the sql/query option.

Common situations: Databend server not running or wrong host/port in the JDBC URL; wrong username/password; query references a non-existent table; network/firewall blocking the driver port; SQL syntax error in a custom query.

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/25fbcdd89c8f51f7. Report an issue: GitHub.