Re: missing clarity on select for update when using with jdbc
Posted by: Mark Matthews
Date: November 21, 2013 08:31PM

Todd Farmer Wrote:
-------------------------------------------------------
> Hello Muralidhar,
>
> The lock you acquire with a SELECT ... FOR UPDATE
> statement is held at the Connection level.

Correction...It's held for the duration of the current transaction that is owned by the connection. If in auto-commit mode (the default in MySQL and JDBC), the rows locked by the SELECT ... FOR UPDATE statement will be released as soon as the statement itself completes. You need to disable auto commit to actually use this feature the way it is intended...SELECT ... FOR UPDATE...(DML here)...connection.commit().

-Mark

Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html

Options: ReplyQuote


Subject
Written By
Posted
Re: missing clarity on select for update when using with jdbc
November 21, 2013 08:31PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.