locked
various isolation levels use in .net RRS feed

  • Question

  • I am using .net and wish to use Com+ for transactional handling.

    I wish to know that if i wish to achieve optimistic concurrency in .net database transactions, which one of the isolcation level to use

    1)readcommitted

    2)readuncommited

    3)repeatableread

    4)serializable

    Also please let me know in which conditions should we use each of these isolation levels.

    Regards

    Thursday, June 29, 2006 12:54 PM

Answers

  • Your're really asking about transaction isolation here. Readcommitted will be your best choice in most cases. Readuncommitted will actually give you higher concurrency, but at the expense of saccrificing the data consistency and integrity guarantees that you normally expect from a database. It has its place, but you need to be pretty sure your app and data will not be compromised by using it. The other isolation levels have lower concurrency but greater consistency and isolation guarantees. See http://msdn2.microsoft.com/en-us/library/ms189130.aspx for more details.

    Optimistic concurrency/Pessimistic concurrency are terms usually used to describe whether rows are locked or not when an app reads them through a cursor regardless of the transaction isolation level. In this sense ADO.Net apps are always optimistic since you have to use server cursors to get 'lock on read' behavior and ADO.Net doesn't support server cursors

    Thursday, June 29, 2006 5:06 PM