Question - How many locking systems are there in JDBC?
Answer -
Two types of locking are available in JDBC by which we can handle more than one user.
If two users are viewing the same record, then no locking is done. If one user is updating a record and the second user is also updating the same record. At that time, we are going to use locking.
- Optimistic Locking: it will lock the record only when we are going to “update.”
- Pessimistic Locking: it will lock the record from the “select” to view, update and commit time.