How is locking implemented?

Showing Answers 1 - 6 of 6 Answers

ravi

  • Aug 18th, 2005
 

Using select... for update

  Was this answer useful?  Yes

onkar

  • Sep 28th, 2005
 

Apart from the given ans, a table can be locked using the following command : LOCK TABLE <TABLENAME> IN <MODE>

where <TABLENAME> is the name of the table u want to lock and <MODE>  is different type of modes in which a table can be locked like shared ,shared exclusive,exclusive etc.

 

  Was this answer useful?  Yes

Culver_lake

  • Mar 18th, 2006
 

Locking in most modern database management systems is implemented implicitly.  That is you never have to ask for a lock nor will you ever fail to release a lock.  In DB2 this is all controlled by the Inter Region Lock Manager (IRLM) sometimes called the Independent Resource Lock Manager.

Every request, not just updates, requires a lock.  If the lock you need conflicts with a lock already held by another process then your process is suspended until the lock you want is released or you time out.

  Was this answer useful?  Yes

Raghunathan Asari

  • Jul 22nd, 2007
 

Whenever an SQL is issued for execution, DB2 checks for lock avoidance by checking the SQL.
Eg. SELECT ...... WITH UR or BIND with ISOLATION (UR) (UR Uncommitted Read)
If not DB2 checks for the number of locks available in the system and the number of locks
requested by the program. Then DB2 asks its lock manager(IRLM) to get a lock for the SQL. IRLM checks the availablity of locks. If available a lock will be allocated and the resource will be locked. If no lock is available, the request for the lock will be in wait state and the execution of  the SQL will be suspended. 
If the wait time  exceeds the maximum waite time, the request will be rejected by a TIMEOUT. 




  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions