Difference between Optimistic and Pessimistic locking

Ask a question
          

Interview questions

Optimistic and Pessimistic locking in ADO.NET


Next question>>
Optimistic and Pessimistic locking in ADO.NET - March 31, 2009 at 17:30 PM by Amit Satpute

What’s difference between “Optimistic” and “Pessimistic” locking?

In pessimistic locking, when a user opens a data to update it, a lock is granted. Other users can only view the data until the whole transaction of the data update is completed.

In optimistic locking, a data is opened for updating by multiple users. A lock is granted only during the update transaction and not for the entire session. Due to this concurrency is increased and is a practical approach of updating the data. 

Optimistic and Pessimistic locking in ADO.NET - June 06, 2009 at 10:30 AM by Shuchi Gauri

What’s difference between “Optimistic” and “Pessimistic” locking?

Pessimistic locking: On updating the data, the record gets locked and no one else can access that record for updating. It becomes a read-only record till the lock is released. Once the lock gets released, the record can be locked again and get updated for a different user.

Optimistic locking: This allows multiple user to open up the same record for updation . Record gets locked only while updating the record. This is the most preferred way of locking for the web application.

Next question>>



Write your comment - Share Knowledge and Experience


Also read     

Explain the namespaces in which .NET has the data functionality class.

System.data contains basic objects. These objects are used for accessing and storing relational data........

Command objects uses, purposes and their methods.

The command objects are used to connect to the Datareader or dataset objects with the help of the following methods.........

How can we perform transactions in .NET?

Here are the general steps that are followed during a transaction....

What is connection pooling and what is the maximum Pool Size in ADO.NET Connection String?

A connection pool is created when a connection is opened the first time.......

 
Latest placement tests
Latest links
 
 
Home | Login | About us | Sitemap | Contact us