By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,586 Members | 2,487 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,586 IT Pros & Developers. It's quick & easy.

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

P: n/a
it is a common question,not for db2,thank u very much
Dec 3 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
<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

P: n/a
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

P: n/a
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.