apache/seatunnel · error · JdbcConnectorException

NO_SUPPORT_OPERATION_FAILED

NO_SUPPORT_OPERATION_FAILED

Error message

unable to open CopyManager Operation in this JDBC writer. Please configure option use_copy_statement = false.

What it means

CopyManagerBatchStatementExecutor.copyManagerProxyChecked() probes whether the JDBC driver's Connection can be adapted into the internal CopyManagerProxy (reflective access to the driver's CopyManager API). If reflection fails (NoSuchMethodException/IllegalAccessException/InvocationTargetException), the driver does not expose a compatible Copy API and a NO_SUPPORT_OPERATION_FAILED JdbcConnectorException is thrown advising use_copy_statement = false.

Source

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

public class CopyManagerBatchStatementExecutor implements JdbcBatchStatementExecutor<SeaTunnelRow> {

    private final String copySql;
    private final TableSchema tableSchema;
    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) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set use_copy_statement = false in the JDBC sink options to fall back to standard batch inserts
  2. Use the standard, unshaded PostgreSQL JDBC driver version compatible with this SeaTunnel release
  3. Verify the driver jar on the classpath actually contains org.postgresql.copy.CopyManager with the expected constructor/method
  4. Remove conflicting older driver jars from the lib/ or plugin directory

Example fix

// before
JdbcSinkOptions: { use_copy_statement = true }
// after
JdbcSinkOptions: { use_copy_statement = false }
Defensive patterns

Strategy: try-catch

Validate before calling

try (Connection c = provider.getConnection()) {
    Class.forName("org.postgresql.Driver");
    Class.forName("org.postgresql.copy.CopyManager"); // driver must expose COPY API
} catch (Throwable t) { log.warn("CopyManager unavailable, set use_copy_statement=false", t); }

Type guard

static boolean driverSupportsCopy(Connection c) throws SQLException {
    return c.isWrapperFor(org.postgresql.PGConnection.class);
}

Try / catch

try {
    CopyManagerBatchStatementExecutor.copyManagerProxyChecked(provider);
} catch (JdbcConnectorException e) {
    if (JdbcConnectorErrorCode.NO_SUPPORT_OPERATION_FAILED.equals(e.getErrorCode())) {
        options.setUseCopyStatement(false); // rebuild executor with batch inserts
    } else throw e;
}

Prevention

When it happens

Trigger: JDBC sink with use_copy_statement=true for PostgreSQL/Greenplum-style COPY writes; the runtime JDBC driver lacks or hides the expected CopyManager method (wrong driver version, shaded/renamed classes, non-PG driver).

Common situations: Driver upgrade/downgrade changed the org.postgresql.copy.CopyManager API surface; using a forked or embedded driver (e.g. pgjdbc shaded differently); accidentally enabling use_copy_statement for a database whose driver has no CopyManager.

Related errors


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