{"record":{"id":"477c0ccbde0f2707","repo":"apache/seatunnel","slug":"failed-to-disable-auto-commit-for-db2-cdc-connecti","errorCode":null,"errorMessage":"Failed to disable auto commit for Db2 CDC connection","messagePattern":"Failed to disable auto commit for Db2 CDC connection","errorType":"exception","errorClass":"java.lang.RuntimeException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/reader/fetch/Db2SourceFetchTaskContext.java","lineNumber":94,"sourceCode":"    private Db2Partition partition;\n    private TopicSelector<TableId> topicSelector;\n    private JdbcSourceEventDispatcher<Db2Partition> dispatcher;\n    private ChangeEventQueue<DataChangeEvent> queue;\n    private ErrorHandler errorHandler;\n    private Db2TaskContext taskContext;\n\n    private SnapshotChangeEventSourceMetrics<Db2Partition> snapshotChangeEventSourceMetrics;\n\n    public Db2SourceFetchTaskContext(\n            Db2SourceConfig sourceConfig, JdbcDataSourceDialect dataSourceDialect) {\n        super(sourceConfig, dataSourceDialect);\n\n        this.dataConnection =\n                Db2ConnectionUtils.createDb2Connection(sourceConfig.getDbzConfiguration());\n        try {\n            this.dataConnection.setAutoCommit(false);\n        } catch (SQLException e) {\n            throw new RuntimeException(\"Failed to disable auto commit for Db2 CDC connection\", e);\n        }\n        this.metadataProvider = new Db2EventMetadataProvider();\n    }\n\n    @Override\n    public void configure(SourceSplitBase sourceSplitBase) {\n        super.registerDatabaseHistory(sourceSplitBase, dataConnection);\n\n        // initial stateful objects\n        final Db2ConnectorConfig connectorConfig = getDbzConnectorConfig();\n\n        this.topicSelector = Db2TopicSelector.defaultSelector(connectorConfig);\n\n        this.databaseSchema = Db2Utils.createDb2DatabaseSchema(connectorConfig, dataConnection);\n\n        String serverName = connectorConfig.getLogicalName();\n        this.partition = new Db2Partition(serverName);\n","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/reader/fetch/Db2SourceFetchTaskContext.java#L76-L112","documentation":"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.","triggerScenarios":"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.","commonSituations":"DB2 server unreachable or connection dropped during job startup; driver/URL misconfiguration producing a dead connection; DB2 instance limits or stale pooled connections.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"try (Connection c = DriverManager.getConnection(url, user, pass)) { c.isValid(5); }","typeGuard":null,"tryCatchPattern":"try { submitJob(); } catch (RuntimeException e) { if (e.getMessage().contains(\"disable auto commit\")) { checkDb2Connectivity(); retryWithBackoff(); } }","preventionTips":["Health-check the DB2 connection before job submission","Keep JDBC driver version aligned with the DB2 server","Avoid submitting jobs during network maintenance windows"],"tags":["db2","jdbc","connection","cdc"],"backgroundTag":"database-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}