Concurrency of multiple transactions in the database

Source: Internet
Author: User
Exception in concurrent database operations-dirty read setting database isolation level: setTRANSACTIONISOLATIONLEVELREADUNCOMMITTEDspanstylefont-size: 14px business scenario: span zhangsan is going to use an ATM to remit 1000 yuan to its Beijing CMB account, use the mobile phone banking client of the smartphone to query the information before the remittance

Exception in concurrent database operations-dirty read setting database isolation level: setTRANSACTION isolation level READUNCOMMITTEDspan style = font-size: 14px business scenario: /span zhangsan wants to use an ATM to remit 1000 yuan to his account of China Merchants Bank in Beijing. He needs to use the mobile phone banking client of his smart phone before receiving the money.

Exception in concurrent database operations-dirty read

Set the database isolation level:

SetTRANSACTION isolation level readuncommitted business scenario:

John wants to use an ATM to remit 1000 yuan to his Beijing Zhaoxing bank account. Before the bank collects the money, he first uses his smartphone's mobile banking client to check that there are 100 yuan remaining in his Beijing account, then he used an ATM to call his Beijing account 1000. When prompted to confirm the submission, he used his mobile phone to check that his account balance was actually 1100.

Exceptions in concurrent database operations-repeated read is not allowed

Set the database isolation level:

SetTRANSACTION isolation level readcommitted; business scenario:

Michael used his smartphone's mobile banking client to check that his Zhaoxing account balance was 100 yuan. He did not quit immediately and then did something else, in this process, his wife remitted 1000 yuan to his account on an ATM. After he came back, he refreshed the balance, which was actually 1100 yuan.

Abnormal database concurrent operations-Magic read)

Set the database isolation level:

SetTRANSACTION isolation level repeatableread; business scenario:

Zhang San used his smartphone's mobile banking client to query his China Merchants Bank account balance of 300 yuan. He planned to use 200 of the funds to buy a commodity, before he made the payment, his wife took 100 yuan. He checked the balance again, or 300 yuan. He paid 200 yuan for the goods. After the payment, he checked the balance again and found that there was no cent in his account!

Concurrent database operations-no concurrency

Set the database isolation level:

setTRANSACTION ISOLATION LEVEL SERIALIZABLE;

Business scenario:

Zhang San used his smartphone's mobile banking client to query his Zhaoxing account balance of 99.9 yuan, but he needed 100 yuan to pay for the flash sale. He told his wife to wait online on QQ, his wife immediately found an ATM and prepared to remit 100 yuan to his account, but the money could not be remitted.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.