469,343 Members | 5,388 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

why commit while finish a select statment

i saw some code typing 'EXEC SQL COMMIT' after a cursor fetch .
isn't it just a share lock while fetching ?

Nov 12 '05 #1
3 2411

<he******@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
i saw some code typing 'EXEC SQL COMMIT' after a cursor fetch .
isn't it just a share lock while fetching ?


Yes, provided the cursor was not defined with FOR UPDATE.

However, locks (both shared and update) are held until a COMMIT is issued.
So you must COMMIT after issuing read-only queries so that these share locks
will be released.

--
Matt Emmerton
Nov 12 '05 #2
you mean COMMIT just releases system resource but has no effect on
enhance concurrency ?

Nov 12 '05 #3
he******@hotmail.com wrote:
you mean COMMIT just releases system resource but has no effect on
enhance concurrency ?


It does have an effect on concurrency if other transactions (units of work)
update the table where the query was run and, therefore, could be blocked
by the shared locks.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Markus Breuer | last post: by
reply views Thread by Fan Ruo Xin | last post: by
1 post views Thread by Anton Nikiforov | last post: by
6 posts views Thread by mabond | last post: by
7 posts views Thread by annecarterfredi | last post: by
2 posts views Thread by gimme_this_gimme_that | last post: by
reply views Thread by zhoujie | 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.