Oracle Database Transaction Mechanism

Source: Internet
Author: User

The transaction mechanism of the Oracle database is a simple record: con. commit (); The transaction is committed manually. Con. setAutoCommit (true); enables JDBC to automatically commit transactions. Con. rollback (); cancels the submission of rollback data. If con. setAutoCommit (true) is used, after the database operation, the data has been actually updated to the database and no more commit is required. At this time, calling con. rollback () is useless. If this parameter is set to false, JDBC does not submit data automatically. Therefore, you must manually use commit or rollback to submit or roll back data. No transaction control is required during query. transaction control is required only when multiple different data in the database needs to be processed synchronously. for example, if a bank withdraws money, it must have a withdrawal record and a change record of the account. If a single withdrawal record occurs, it cannot be set to false, after both operations are completed, use commit to submit them together. if one of them has a problem, you can use rollback to roll back both of them to ensure data consistency.

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.