| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

06-15-07, 00:00
|
|
Registered User
|
|
Join Date: Jun 2007
Posts: 189
|
|
lock table
|

06-15-07, 02:52
|
|
Registered User
|
|
Join Date: Jun 2006
Posts: 471
|
|
according the doc :
-LOCK TABLE--+-table-name-+--IN--+-SHARE-----+--MODE---------><
'-nickname---' '-EXCLUSIVE-'
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
|
|

06-15-07, 10:00
|
|
Registered User
|
|
Join Date: Jun 2007
Posts: 189
|
|
|
|
thanks for giving me suggestion its working
but after locking table i can select table ,insert data,alter ,delete
so what will be use of locking table??
|
|

06-15-07, 11:33
|
|
Registered User
|
|
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
|
|
Quote:
|
Originally Posted by ankur02018
after locking table i can select table ,insert data,alter ,delete
so what will be use of locking table??
|
That's exactly why you would lock the table: so that *you* can insert, delete, etc. in the table, while *others* cannot interfere.
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
|
|

06-15-07, 12:38
|
|
Registered User
|
|
Join Date: Jun 2007
Posts: 189
|
|
suppose i connect to database as
connect to cricket user ism using ism
then
lock table bcci in share mode
now I can insert , update , delete etc to that table
even other user can also do by connecting that particular database
how can we apply bar to other user on that table by locking
|
|

06-15-07, 13:06
|
|
:-)
|
|
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
|
|
Locks are released on commit. If you don't switch autocommit off (which I suspect is the case) your lock is released right after the LOCK statement is issued.
|
|

06-15-07, 13:26
|
|
Registered User
|
|
Join Date: Jun 2007
Posts: 189
|
|
Quote:
|
Originally Posted by n_i
Locks are released on commit. If you don't switch autocommit off (which I suspect is the case) your lock is released right after the LOCK statement is issued.
|
no i think this is not the case because autocommint is on
|
|

06-15-07, 15:48
|
|
:-)
|
|
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
|
|
Quote:
|
Originally Posted by ankur02018
no i think this is not the case because autocommint is on
|
It's really easy to check: just take a locks snapshot after the LOCK statement.
|
|

06-18-07, 01:33
|
|
Registered User
|
|
Join Date: Jun 2007
Posts: 189
|
|
Quote:
|
Originally Posted by n_i
It's really easy to check: just take a locks snapshot after the LOCK statement.
|
can you tell in brief how we can check our autocommit status
|
|

06-18-07, 03:01
|
|
Registered User
|
|
Join Date: Jun 2007
Posts: 189
|
|
Quote:
|
Originally Posted by ankur02018
can you tell in brief how we can check our autocommit status
|
yeah I got the command to check your auto commit status
but cant find find whats use of lock tables ?
|
|

06-25-07, 05:58
|
|
Registered User
|
|
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
|
|
If you acquire a lock in "shared" mode, then other users will be able to access the table and select from it. They won't be able to write to the table.
Different question: why exactly do you want to lock the table? DB2 (or any other decent DBMS) will take care of locking for you and your application should not even worry about it.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
|
|

06-28-07, 12:30
|
|
Registered User
|
|
Join Date: Jun 2007
Posts: 189
|
|
please make me clear why locking tables
|
|

06-29-07, 03:41
|
|
Registered User
|
|
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
|
|
First, you don't have to lock tables yourself.
Sometimes it may be beneficial to explicitly lock a table to prevent DB2 from acquiring row locks which may later on be escalated to a table lock. But this is something you only do if really necessary.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|