top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

What are the different types of locking in JDBC?

+1 vote
43 views
What are the different types of locking in JDBC?
posted Aug 24, 2017 by Ayush Srivastav

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

A lock is a preventive software mechanism that other users can not use the data resource.

The types of locks in JDBC:

1. Row and Key Locks:

Useful when updating the rows (update, insert or delete operations), as they increase concurrency.

2. Page Locks:

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.

3. 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.

4. Database Lock:

In order to prevent the read or update access from other transactions when the database is open, the database lock is used.

answer Sep 6, 2017 by Manikandan J
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...