OLE DB defines an interface, ITransactionJoin, for consumers to request that providers enlist in a coordinated transaction among multiple (possibly distributed) data providers and other types of resource managers. Calling ITransaction::Commit or ITransaction::Abort on the session commits or aborts, respectively, the transaction at the lowest level. A consumer can interrogate the transaction capabilities of a provider through IDBProperties.įor providers that support nested transactions, calling ITransactionLocal::StartTransaction within an existing transaction begins a new nested transaction below the current transaction. OLE DB providers do not need to support all possible transaction options defined. ITransactionLocal::StartTransaction supports various isolation levels that consumers can request when creating a transaction. When a session enters a local or coordinated transaction, all the work done under the session ? between the ITransactionLocal::StartTransaction and ITransaction::Commit or ITransaction::Abort method calls and including other objects created underneath it (commands or rowsets) ? is part of the transaction. When created, a session is outside of a transaction and all the work done under the scope of the session is immediately committed on each OLE DB method call. A session can be inside or outside of a transaction at any time. A call to ITransactionLocal::StartTransaction begins a transaction on the session. A provider that supports transactions exposes ITransactionLocal on the session. Local transactions refer to transactions running in the context of a resource manager. Transactions allow the specification of various isolation levels to enable more flexible access to data among concurrent consumers. These units of work have the atomicity, concurrency, isolation, and durability (ACID) properties. A transaction enables consumers to define units of work within a provider. The recovery subsystem of the DBMS has the responsibility of Durability property.OLE DB defines a basic set of interfaces for transaction management.That consistent state cannot be lost, even in the event of a system's failure. When a transaction is completed, then the database reaches a state known as the consistent state. They cannot be lost by the erroneous operation of a faulty transaction or by the system failure.It states that the transaction made the permanent changes. The durability property is used to indicate the performance of the database's consistent state.The concurrency control subsystem of the DBMS enforced the isolation property.In isolation, if the transaction T1 is being executed and using the data item X, then that data item can't be accessed by any other transaction T2 until the transaction T1 ends.It shows that the data which is used at the time of execution of a transaction cannot be used by the second transaction until the first one is completed.In the case when T1 is completed but T2 fails, then inconsistency will occur. The transaction is used to transform the database from one consistent state to another consistent state.įor example: The total amount must be maintained before or after the transaction.The consistent property of database states that every transaction sees a consistent database instance.The execution of a transaction will leave a database in either its prior stable state or a new stable state.The integrity constraints are maintained so that the database is consistent before and after the transaction. In order to ensure correctness of database state, the transaction must be executed in entirety. This shows the inconsistent database state. If the transaction T fails after the completion of transaction T1 but before completion of transaction T2, then the amount will be deducted from A but not added to B. T1Īfter completion of the transaction, A consists of Rs 500 and B consists of Rs 400. Transfer Rs 100 from account A to account B. A consists of Rs 600 and B consists of Rs 300. Each transaction is treated as one unit and either run to completion or is not executed at all.Ītomicity involves the following two operations:Ībort: If a transaction aborts then all the changes made are not visible.Ĭommit: If a transaction commits then all the changes made are visible.Įxample: Let's assume that following transaction T consisting of T1 and T2. There is no midway, i.e., the transaction cannot occur partially.It states that all operations of the transaction take place at once if not, the transaction is aborted.These are used to maintain consistency in a database, before and after the transaction.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |