Skip to content

Commit

Permalink
[Bug] [connector-jdbc-v2] Fix transaction force commit when autoCommi…
Browse files Browse the repository at this point in the history
…t is enabled (apache#2636)
  • Loading branch information
hailin0 authored and MRYOG committed Sep 15, 2022
1 parent af86ffb commit a642164
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ public void executeBatch() throws SQLException {
batch.clear();

// cache commit
st.getConnection().commit();
if (!st.getConnection().getAutoCommit()) {
st.getConnection().commit();
}
st.clearParameters();
st.clearBatch();

Expand All @@ -78,6 +80,9 @@ public void executeBatch() throws SQLException {
@Override
public void closeStatements() throws SQLException {
if (st != null) {
if (!st.getConnection().getAutoCommit()) {
st.getConnection().commit();
}
st.close();
st = null;
}
Expand Down

0 comments on commit a642164

Please sign in to comment.