apache/seatunnel · error · java.lang.RuntimeException
Failed to disable auto commit for Db2 CDC connection
Error message
Failed to disable auto commit for Db2 CDC connection
What it means
Db2SourceFetchTaskContext wraps the JDBC data connection used for snapshot/streaming reads and requires autoCommit to be disabled so reads run in a consistent transaction. If setAutoCommit(false) fails at the JDBC level, the task cannot proceed safely and fails fast with this RuntimeException.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/reader/fetch/Db2SourceFetchTaskContext.java:94
private Db2Partition partition;
private TopicSelector<TableId> topicSelector;
private JdbcSourceEventDispatcher<Db2Partition> dispatcher;
private ChangeEventQueue<DataChangeEvent> queue;
private ErrorHandler errorHandler;
private Db2TaskContext taskContext;
private SnapshotChangeEventSourceMetrics<Db2Partition> snapshotChangeEventSourceMetrics;
public Db2SourceFetchTaskContext(
Db2SourceConfig sourceConfig, JdbcDataSourceDialect dataSourceDialect) {
super(sourceConfig, dataSourceDialect);
this.dataConnection =
Db2ConnectionUtils.createDb2Connection(sourceConfig.getDbzConfiguration());
try {
this.dataConnection.setAutoCommit(false);
} catch (SQLException e) {
throw new RuntimeException("Failed to disable auto commit for Db2 CDC connection", e);
}
this.metadataProvider = new Db2EventMetadataProvider();
}
@Override
public void configure(SourceSplitBase sourceSplitBase) {
super.registerDatabaseHistory(sourceSplitBase, dataConnection);
// initial stateful objects
final Db2ConnectorConfig connectorConfig = getDbzConnectorConfig();
this.topicSelector = Db2TopicSelector.defaultSelector(connectorConfig);
this.databaseSchema = Db2Utils.createDb2DatabaseSchema(connectorConfig, dataConnection);
String serverName = connectorConfig.getLogicalName();
this.partition = new Db2Partition(serverName);
View on GitHub (pinned to cf67b549a7)
Solutions
- Verify DB2 connectivity and credentials (test the JDBC URL from the same network)
- Check that the DB2 JDBC driver version matches your DB2 server version
- Inspect logs for the wrapped SQLException cause to identify the underlying JDBC problem
- Enable connection validation/keepalive and retry job submission after the database is reachable
Defensive patterns
Strategy: retry
Validate before calling
try (Connection c = DriverManager.getConnection(url, user, pass)) { c.isValid(5); } Try / catch
try { submitJob(); } catch (RuntimeException e) { if (e.getMessage().contains("disable auto commit")) { checkDb2Connectivity(); retryWithBackoff(); } } Prevention
- Health-check the DB2 connection before job submission
- Keep JDBC driver version aligned with the DB2 server
- Avoid submitting jobs during network maintenance windows
When it happens
Trigger: Creating a Db2SourceFetchTaskContext when connection.setAutoCommit(false) throws SQLException — e.g. the connection is closed/broken, the DB2 JDBC driver rejects the call, or network failure during connection setup.
Common situations: DB2 server unreachable or connection dropped during job startup; driver/URL misconfiguration producing a dead connection; DB2 instance limits or stale pooled connections.
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
- Error to check tables:
- Failed to discover remaining tables to capture
- Error to discover tables:
- Read the binlog offset error
- Failed to read schema for table %s
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/477c0ccbde0f2707.
Report an issue: GitHub.