How many locking systems are there in JDBC?

JDBCJava 8MySQLMySQLi Database

You can lock a record, set of records, database table, table-space etc. and when we do we cannot change the locked values. Following are the types of locking in JDBC:

  • Row and Key Locks: These are used to lock a particular row. Using these locks, you can achieve concurrency.

  • Page Locks: These are used to lock a page. If you apply this, whenever the contents of a row changes, the database locks the entire page which holds the row. If you need to update/change large number of rows at once you can use this lock.

  • Table Locks: You can lock a table using these locks there are two kinds of table locks. Shared and exclusive.

  • Database Lock: This locks the whole database. You can use this lock to prevent transactions of other database to access the current database.

Published on 20-Mar-2019 16:28:12