Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Explicit Locks in DB2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ramp_senti

New User


Joined: 17 Mar 2006
Posts: 26

PostPosted: Fri Mar 17, 2006 10:11 am    Post subject: Explicit Locks in DB2
Reply with quote

Hi..,
Can any of u explain me how to use explicit locks in DB2 with the syntax.
Back to top
View user's profile Send private message

martin9

Active User


Joined: 01 Mar 2006
Posts: 287
Location: Basel, Switzerland

PostPosted: Fri Mar 17, 2006 6:30 pm    Post subject:
Reply with quote

hy ramp_senti,

Syntax

+------------------------------------------------------------------------+
! !
! >>--LOCK TABLE--table-name-------------------------------------------> !
! +-PARTITION--integer-+ !
! !
! >--IN----SHARE--------MODE------------------------------------------>< !
! +-EXCLUSIVE-+ !
! !
+------------------------------------------------------------------------+

martin9
Back to top
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Mon Mar 20, 2006 1:01 pm    Post subject:
Reply with quote

Hi,

Following are the two syntax for LOCK :

1. LOCK TABLE table-name IN SHARE MODE;
ex - LOCK TABLE UPAD.EMPLOYEE IN EXCLUSIVE MODE;

2. LOCK TABLE table-name PART n IN EXCLUSIVE MODE;
ex- LOCK TABLE UPAD.EMPLOYEE PART 1 IN EXCLUSIVE MODE;
When the statement is executed, DB2 locks partition 1 with an X lock. The
lock has no effect on locks that already exist on other partitions in the
table space.

Thanks,
KS
Back to top
View user's profile Send private message
ramp_senti

New User


Joined: 17 Mar 2006
Posts: 26

PostPosted: Tue Mar 21, 2006 10:53 am    Post subject: Re: Explicit Locks in DB2
Reply with quote

Thanks Martin & KS..

How long will the lock be valid..i mean will it be released once the program gets over or do we have to release it explicitly...
Back to top
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Thu Mar 23, 2006 1:03 pm    Post subject:
Reply with quote

I think locks are held until commit or rollback.
Correct if am wrong.
Thanks,
KS
Back to top
View user's profile Send private message
ramp_senti

New User


Joined: 17 Mar 2006
Posts: 26

PostPosted: Fri Mar 24, 2006 1:41 pm    Post subject: Re: Explicit Locks in DB2
Reply with quote

Hai KS..,
It seems that the lock gets released only when the program ends...i tried to run a select query on the same table which is locked by another program..but the select query is performed only when the program which has locked the table ends....


Okay then any info abt explicit row level locking...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Finding locks on z/OS DB2? Ed Goodman DB2 2 Fri Aug 22, 2014 11:55 pm
No new posts How to get the explicit GDG name in t... raja krishnaswamy All Other Mainframe Topics 4 Tue Nov 01, 2011 1:52 pm
No new posts Explicit Commit kaustubhkhole DB2 2 Sun Apr 18, 2010 7:11 pm
No new posts Locks cant be obtained on? shyam6385 Mainframe Interview Questions 1 Thu Oct 29, 2009 12:42 pm
No new posts Locks on Views rakesh1155 DB2 2 Mon Oct 12, 2009 7:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us