Can you explain the term concurrency?
Concurrency issues happen in multiuser environment when multiple people update the same data at the same time.
Below is the sequence of events how concurrency issues can happen:-
- User A fetches data with value “X” and starts changing this value to “Y”.
- User B also fetches the same “X” data and starts changing this value to “Z”.
- Now User B first updates the data to database. In other words he changes the data to “Z”.
- Now User A also sends the update to database. In other words he changes the data to “Y”.
Now User A thinks he has changed “X” to “Y” and User B thinks the current data is “Z”. Both of them are wrong and this leads to confusion termed as “Concurrency” problem.
How can we resolve concurrency issue?
Concurrency issue can be resolved by using optimistic or pessimistic locking.
See following video on ADO.NET Connection pooling: –
Click and see here on Online resource for learning ADO.NET