Transaction Concept _ Four characteristics

Source: Internet
Author: User

1. Transaction Concept _ four characteristics

First, the business

The concept of a transaction : A transaction is a logical set of operations that either completes at the same time or is not completed at the same time .

Management of transactions : By default , the database automatically manages transactions , which is managed by a single statement that is exclusive of a transaction .

If you need to control the transaction yourself, you can also open / commit / rollback the transaction with the following command

Start transaction;

Commit

Rollback

managing transactions in JDBC :

Conn.setautocommit (FALSE);

Conn.commit ();

Conn.rollback ();

SavePoint sp = Conn.setsavepoint ();

Conn.rollback (SP);

Four characteristics of a transaction: the most basic feature of a transaction , a well-designed database can help us ensure that transactions have these four characteristics (ACID)

1. Atomic Nature : atomicity means that a transaction is an inseparable unit of work, and the operations in the transaction either occur or do not occur.

2 consistency So after the end of the transaction ,

Integrity State of the database : When all the data in a database conforms to all the constraints defined in the database , It can be said that the database is an integrity state .

3. isolation : the isolation of transactions means that when multiple users access the database concurrently, the transaction of one user cannot be interfered by other users ' transactions, and the data between multiple concurrent transactions is isolated from each other.

4. Durability : persistence refers to the fact that once a transaction is committed, it changes the data in the database to be permanent, and then it should not have any effect even if the database fails.

Isolation :

The design of the database as a single -threaded database prevents all thread-safety issues and naturally ensures isolation . But if the database is designed like this , then the efficiency will be extremely low . .


Transaction Concept _ Four characteristics

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.