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

why commit while finish a select statment

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a

<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

P: n/a
you mean COMMIT just releases system resource but has no effect on
enhance concurrency ?

Nov 12 '05 #3

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