What is the relationship between the defaultAutoCommit and spring transaction management of the database pool and the underlying database settings?

I remember that spring transaction management defaults to false, but there seems to be a conflict between many database pools, including druid, autocommit, which defaults to true,. In addition, autocommit, can also be configured in the configuration of the underlying database, such as mysql, so which of the three has the highest priority, that is, which setting can override the others?

in addition, there are two kinds of understanding of autocommit here
1) when the whole transaction is about to end, the transaction management AOP automatically commits
2) when each sql statement is executed, it commits automatically

which is the so-called autocommit in the defaultAutoCommit and spring transaction management of the database pool?

Jan.21,2022

is not clear about spring, but at the database level, the auto-commit of
MySQL is automatically committed after each statement from the client is executed.
but if you explicitly open a transaction using begin or start transaction, you need the displayed commit or rollback to end the transaction.
of course, executing DDL within a transaction triggers an implicit commit.


aotucommit

When

autocommit is off , as long as the DML statement (including select ) is executed, a transaction ( begin ) is automatically opened, and the transaction
autocommit is not terminated until commit or rollback is executed
autocommit is on .

priority

manual settings can override the default settings, that is, spring and druid can override mysql configured autocommit
the latter setting overrides the previous setting, druid first, spring then

Menu