Question: what are different type of locks
what are different type of locks
Types of locks in JDBC:
Row and Key Locks:: It is useful when updating the rows (update, insert or delete operations), as they increase concurrency.
Page Locks: It locks the page when the transaction updates or inserts or deletes rows or keys. The database server locks the entire page that contains the row. The lock is made only once by database server, even more rows are updated. This lock is suggested in the situation where large number of rows is to be changed at once.
Table Locks: Utilizing table locks is efficient when a query accesses most of the tables of a table. These are of two types:
a) Shared lock: One shared lock is placed by the database server, which prevents other to perform any update operations.
b) Exclusive lock: One exclusive lock is placed by the database server, irrespective of the number of the rows that are updated.
Database Lock: In order to prevent the read or update access from other transactions when the database is open, the database lock is used.