Optimistic and pessimistic locking in JDBC - posted by Nishant
Explain optimistic and pessimistic locking in JDBC.
Answer
There are two kinds of locking available in JDBC.
Optimistic Locking
Pessimistic Locking
Pessimistic Locking locks the records as soon as it selects the row to update.
Optimistic Locking locks the record only when updating takes place.
Optimistic and pessimistic locking in JDBC - posted by Vidya Sagar
Explain the optimistic and pessimistic locking in JDBC.
Optimistic Locking:
Optimistic locking ensure the locks are held between selecting, updating, or
deleting rows. This process needs a way to ensure that the changes to data are
not performed between the time of being read and being altered. The primary
advantage of optimistic locking is , it minimizes the time for which a given
resource is unavailable which is used by another transaction and in this way it
more scalable locking alternative.
Pessimistic Locking:
The pessimistic locking strategy assumes the probability of modifying a row that
is used by one user can be used by another user for modifying. In this
scenario, a lock is held between the row selection time and the updation time
for changing operations on that row. The pessimistic locking strategy
guarantees the changes are made safely and consistently.
More JDBC Links
Answer - Resultset contains results of the SQL query.....
What
are different transaction levels in JDBC?
Answer - Transaction Isolation levels is used to implement
locking.....
Answer - If you execute a query at time T1 and re-execute it at
time T2, additional rows may have.....
Answer - Businesses can continue to use their installed
databases and access.....
|