From b1c92a82e4e785fd7b2024f42e21f57cc9b3fae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=89=91=20Jian?= Date: Mon, 12 Aug 2024 19:36:33 +0800 Subject: [PATCH] [Bug-#1913][chunjun-connector-jdbc-base] clickhouse jdbc connection are not Not supporting transactions. --- .../chunjun/connector/jdbc/source/JdbcInputFormat.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chunjun-connectors/chunjun-connector-jdbc-base/src/main/java/com/dtstack/chunjun/connector/jdbc/source/JdbcInputFormat.java b/chunjun-connectors/chunjun-connector-jdbc-base/src/main/java/com/dtstack/chunjun/connector/jdbc/source/JdbcInputFormat.java index ecb9c76df3..344e68f121 100644 --- a/chunjun-connectors/chunjun-connector-jdbc-base/src/main/java/com/dtstack/chunjun/connector/jdbc/source/JdbcInputFormat.java +++ b/chunjun-connectors/chunjun-connector-jdbc-base/src/main/java/com/dtstack/chunjun/connector/jdbc/source/JdbcInputFormat.java @@ -25,6 +25,7 @@ import com.dtstack.chunjun.connector.jdbc.util.key.KeyUtil; import com.dtstack.chunjun.constants.Metrics; import com.dtstack.chunjun.enums.ColumnType; +import com.dtstack.chunjun.enums.Semantic; import com.dtstack.chunjun.metrics.BigIntegerAccumulator; import com.dtstack.chunjun.metrics.StringAccumulator; import com.dtstack.chunjun.restore.FormatState; @@ -105,7 +106,9 @@ public void openInternal(InputSplit inputSplit) { String querySQL = null; try { dbConn = getConnection(); - dbConn.setAutoCommit(false); + if (Semantic.getByName(config.getSemantic()) == Semantic.EXACTLY_ONCE) { + dbConn.setAutoCommit(false); + } querySQL = buildQuerySql(currentJdbcInputSplit); jdbcConfig.setQuerySql(querySQL);