First, the business
Simply put, business is just one thing. All transaction-related content is carried out around the same thing.
Second, the characteristics of the transaction: ACID
A:atomicity (atomicity), a transaction must be an indivisible whole.
C:consistency (consistency), the data is not destroyed after the database operation is performed. such as: From a account transfer to B, to ensure that a account deduction, B account can increase the amount of money.
I:isolation (isolation), many people in the same data at the same time to operate, if not to control, it will cause a lot of trouble. And this control means isolation.
D:durability (persistent), if an INSERT statement is executed, the database must ensure that a single piece of data is permanently stored in the database.
The ACID property of the transaction is to ensure the consistency of the data. Isolation is a means of ensuring transactional consistency.
Iii. Isolation levels of transactions (Transanction isolation Level)
As stated above, the isolation of transactions. The control referred to here is the isolation level.
(1) Read_uncommited: Read not submitted
(2) Read_commited: Read submitted
(3) Repeatable_read: Repeatable reading
(4) SERIALIZABLE:
From the top down, concurrency is getting worse, and security is getting higher.
Iv. issues existing in the transaction
(1) Dirty read--transaction a reads the uncommitted data from transaction B and does other things on this basis.
(2) Non-repeatable read-transaction a reads the changed data submitted by transaction B.
(3) Phantom read-transaction A reads the new data that has been submitted by transaction B.
No matter under what circumstances, dirty reading is not allowed.
V. The correspondence between the isolation level of the transaction and the problems in the transaction
In fact, the existence of the isolation level of the transaction is in itself to solve the problem in the transaction.
The default isolation level for MySQL is read_commited.
It should be recalled that the transaction isolation level specification described here is JDBC.
To the database level, the isolation level is controlled by locks, and when data is inserted, the lock table is called the "lock table". When the data is updated, the lock line is called "Lock Line".
Java Basics-Transaction