ISDS-3110---Chap10 (1)

ISDS-3110---Chap10 (1) - Transaction Management and...

Info icon This preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Transaction Management and Concurrency Control Chapter 10
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
What Is a Transaction? A transaction is a logical unit of work that must be either entirely completed or aborted; no intermediate states are acceptable. Most real-world database transactions are formed by two or more database requests . A database request is the equivalent of a single SQL statement in an application program or transaction. A transaction that changes the contents of the database must alter the database from one consistent database state to another. To ensure consistency of the database, every transaction must begin with the database in a known consistent state.
Image of page 2
Example Of A Transaction What steps are involved in completing this transaction?
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Example of a Transaction An accountant wishes to register the credit sale of 100 units of product X to customer Y in the amount of $500.00: Reducing product X’s Quantity on hand by 100. Adding $500.00 to customer Y’s accounts receivable. UPDATE PRODUCT SET PROD_QOH = PROD_QOH - 100 WHERE PROD_CODE = ‘X’; UPDATE ACCREC SET AR_BALANCE = AR_BALANCE + 500 WHERE AR_NUM = ‘Y’; If the above two transactions are not completely executed, the transaction yields an inconsistent database . Why?
Image of page 4
Transaction Management Ensure complete execution of a transaction Incomplete transactions must be rolled back Concurrency Control Special steps must be taken when two transactions attempt to use the same data at the same time Transaction Properties Atomicity Durability Serializability Isolation
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Transaction Management with SQL Transaction support is provided by two SQL statements: COMMIT and ROLLBACK . When a transaction sequence is initiated, it must continue through all succeeding SQL statements until one of the following four events occurs: (1) A COMMIT statement is reached. (2) A ROLLBACK statement is reached. (3) The end of a program is successfully reached (equivalent to a COMMIT ). (4) The program is abnormally terminated (equivalent to a ROLLBACK ).
Image of page 6
Transaction Management with SQL Example: Begin Tran UPDATE PRODUCT SET PROD_QOH = PROD_QOH - 100 WHERE PROD_CODE = ‘345TYX’; UPDATE ACCREC SET AR_BALANCE = AR_BALANCE + 3500 WHERE AR_NUM = ‘60120010’; Commit tran (or Rollback Tran)
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern