> 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.
db2db2db2@gmail.com - 04 Dec 2007 00:10 GMT
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.
> <db2db2...@gmail.com> wrote in message
>
[quoted text clipped - 14 lines]
> Not all databases work the same way in this regard, so the above applies to
> DB2.
Knut Stolze - 05 Dec 2007 09:46 GMT
> 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.)

Signature
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany