apache/seatunnel · critical · DatabendConnectorException

CONNECT_FAILED

CONNECT_FAILED

Error message

Failed to connect to Databend: {e.getMessage()}

What it means

DatabendSink.createWriter failed to establish the JDBC connection/prepare sink resources needed by the writer. The SQLException from connecting to Databend is wrapped with code CONNECT_FAILED. No writer is created and the task fails at initialization.

Source

Thrown at seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/sink/DatabendSink.java:165

            @NonNull SinkWriter.Context context) throws IOException {
        try {
            Connection connection = DatabendUtil.createConnection(databendSinkConfig);
            connection.setAutoCommit(autoCommit);

            return new DatabendSinkWriter(
                    context,
                    connection,
                    catalogTable,
                    databendSinkConfig,
                    customSql,
                    database,
                    table,
                    rawTableName,
                    streamName,
                    batchSize,
                    executeTimeoutSec);
        } catch (SQLException e) {
            throw new DatabendConnectorException(
                    DatabendConnectorErrorCode.CONNECT_FAILED,
                    "Failed to connect to Databend: " + e.getMessage(),
                    e);
        }
    }

    @Override
    public Optional<SaveModeHandler> getSaveModeHandler() {
        try {
            // create table path
            TablePath tablePath = TablePath.of(database, table);

            // create DatabendCatalog
            DatabendCatalog databendCatalog =
                    new DatabendCatalog(readonlyConfig, DatabendCatalogFactory.IDENTIFIER);

            // return SaveModeHandler
            return Optional.of(

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify url, username, password and database in the sink config; test with a JDBC client
  2. Check network reachability (host, port 8000/443, firewalls) to Databend
  3. Confirm the database/table names exist or auto-create is properly configured
  4. Review the cause exception for auth vs. connection failures

Example fix

// before
url = "databend://db-host:8000"
// after (correct scheme/port and credentials)
url = "jdbc:databend://db-host:443?ssl=true"
username = "default"
password = "****"
Defensive patterns

Strategy: retry

Validate before calling

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

Try / catch

try {
    sink.createWriter(context);
} catch (DatabendConnectorException e) {
    if (e.getErrorCode() == DatabendConnectorErrorCode.CONNECT_FAILED) {
        // backoff and retry, or fail fast with a clear config error
    } else { throw e; }
}

Prevention

When it happens

Trigger: createWriter calling DatabendUtil to connect (and optionally create the raw table/stream for CDC) and receiving a SQLException — wrong URL/host/port, bad credentials, unreachable server, or invalid database.

Common situations: Misconfigured url/username/password in the sink options; Databend behind a firewall or wrong port; database name typo; SSL requirements not met.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


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