Explain different types of locks in JDBC?

devquora
devquora

Posted On: Feb 22, 2018

 

Four types of locks are available in JDBC. These are: -

  • Row and Key Locks: This kind of lock is used to update the rows.
  • Page Locks: This kind of lock is used for a page. It is used in the case when a transaction remains in the process and continuously updated, inserting, deleting the data in a row of the table. Page locks are performed its action by locking the entire page. But it is only used once by the database users.
  • Table locks: As the name suggests, Table locks are utilized to the table. This can be possibly done by the two methods that are shared and exclusive. A shared lock allows the other transactions to see the table but not let them update it. Nonetheless, the exclusive lock blocks others transaction from reading and writing the table.
  • Database locks: It is the lock that is used when the database is open and it helps to prevent the read and update access from other transactions. This kind of lock blocks the other transaction to perform an operation when there is any database opened.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    JDBC interview questions

    What is the full form of JDBC and what is its purpose?

    JDBC stands for Java Database connectivity which is an application that helps in connection for the programming of Java language...

    JDBC interview questions

    What do you understand by JDBC driver and explain its types?

    JDBC drivers are software that enables the Java application to connect with the database..