apache/seatunnel · error · JdbcConnectorException

CREATE_DRIVER_FAILED

CREATE_DRIVER_FAILED

Error message

unable to open JDBC writer

What it means

In copyManagerProxyChecked(), if the probe connection itself throws SQLException (cannot get/open a connection to run the COPY probe), the error is wrapped as CREATE_DRIVER_FAILED with message 'unable to open JDBC writer'. It signals the JDBC writer could not establish the driver connection needed for COPY.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/executor/CopyManagerBatchStatementExecutor.java:66

    CopyManagerProxy copyManagerProxy;
    CSVFormat csvFormat = CSVFormat.POSTGRESQL_CSV;
    CSVPrinter csvPrinter;

    public CopyManagerBatchStatementExecutor(String copySql, TableSchema tableSchema) {
        this.copySql = copySql;
        this.tableSchema = tableSchema;
    }

    public static void copyManagerProxyChecked(JdbcConnectionProvider connectionProvider) {
        try (Connection connection = connectionProvider.getConnection()) {
            new CopyManagerProxy(connection);
        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
            throw new JdbcConnectorException(
                    JdbcConnectorErrorCode.NO_SUPPORT_OPERATION_FAILED,
                    "unable to open CopyManager Operation in this JDBC writer. Please configure option use_copy_statement = false.",
                    e);
        } catch (SQLException e) {
            throw new JdbcConnectorException(
                    JdbcConnectorErrorCode.CREATE_DRIVER_FAILED, "unable to open JDBC writer", e);
        }
    }

    @Override
    public void prepareStatements(Connection connection) throws SQLException {
        try {
            this.copyManagerProxy = new CopyManagerProxy(connection);
            this.csvPrinter = new CSVPrinter(new StringBuilder(), csvFormat);
        } catch (NoSuchMethodException
                | IllegalAccessException
                | InvocationTargetException
                | IOException e) {
            throw new JdbcConnectorException(
                    JdbcConnectorErrorCode.NO_SUPPORT_OPERATION_FAILED,
                    "unable to open CopyManager Operation in this JDBC writer. Please configure option use_copy_statement = false.",
                    e);
        } catch (SQLException e) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check connectivity to the database (host, port, firewall, pg_hba.conf rules)
  2. Validate url/user/password in the JDBC sink options by connecting with psql or another client
  3. Ensure the correct JDBC driver jar is present in the SeaTunnel connector lib directory
  4. Review the caused-by chain of this exception for the underlying driver error

Example fix

// before
url = "jdbc:postgresql://wrong-host:5432/db"
// after
url = "jdbc:postgresql://db-host:5432/db"  // verify with: psql 'postgresql://db-host:5432/db'
Defensive patterns

Strategy: retry

Validate before calling

// before job submission
try (Connection c = DriverManager.getConnection(url, user, pass)) {
    c.isValid(5);
}

Try / catch

try {
    CopyManagerBatchStatementExecutor.copyManagerProxyChecked(provider);
} catch (JdbcConnectorException e) {
    if (JdbcConnectorErrorCode.CREATE_DRIVER_FAILED.equals(e.getErrorCode())) {
        retryWithBackoff(() -> copyManagerProxyChecked(provider)); // transient connectivity
    } else throw e;
}

Prevention

When it happens

Trigger: use_copy_statement=true sink initialization when connectionProvider.getConnection() fails — bad URL, unreachable host, wrong credentials, driver not registered, or connection pool exhausted.

Common situations: Network/firewall blocking the DB port; expired or wrong password; driver jar missing from the plugin lib directory so no suitable driver is found.

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