469,356 Members | 2,045 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

A simple question:whether deadlcok will occur if db only select andthers is no lock for reading

it is a common question,not for db2,thank u very much
Dec 3 '07 #1
3 2057
<db*******@gmail.comwrote in message
news:72**********************************@b40g2000 prf.googlegroups.com...
it is a common question,not for db2,thank u very much
When you do a select, there is a share lock, which could be part of a
lockwait or deadlock scenario if there are the right combination of other
exclusive locks (insert, update, delete, select for update, or certain
utililities).

Share locks by themselves, even if they occur from many applications on the
same row, do not conflict with eachother and cannot cause a lockwait or
deadlock situation without some other insert, update, delete, select for
update.

Not all databases work the same way in this regard, so the above applies to
DB2.
Dec 3 '07 #2
thanks.
so your mean that only selecting will not cause deadlock using
db2,even there is a share lock
i know that there is no lock if only select records using oracle.
On Dec 4, 4:44 am, "Mark A" <nob...@nowhere.comwrote:
<db2db2...@gmail.comwrote in message

news:72**********************************@b40g2000 prf.googlegroups.com...
it is a common question,not for db2,thank u very much

When you do a select, there is a share lock, which could be part of a
lockwait or deadlock scenario if there are the right combination of other
exclusive locks (insert, update, delete, select for update, or certain
utililities).

Share locks by themselves, even if they occur from many applications on the
same row, do not conflict with eachother and cannot cause a lockwait or
deadlock situation without some other insert, update, delete, select for
update.

Not all databases work the same way in this regard, so the above applies to
DB2.
Dec 4 '07 #3
db*******@gmail.com wrote:
so your mean that only selecting will not cause deadlock using
db2,even there is a share lock
A share lock means that the resource being locked can be accessed by
different transactions together, i.e. they can "share" the resource.

Note, however, that some applications append the FOR UPDATE clause to SELECT
statements that do not explicitly contain FOR READ ONLY. This is a really
bad idea but not something that can easily be changed. (PHP is a good
example here.)

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Dec 5 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Paul Moberg | last post: by
4 posts views Thread by DBC User | last post: by
9 posts views Thread by Mike R | last post: by
1 post views Thread by elubin_nospam | last post: by
4 posts views Thread by michael.schmitz | last post: by
6 posts views Thread by Spam Catcher | last post: by
1 post views Thread by ramiroe | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.