Re: Use MySql Update Lock or Java Thread-Safe???
Posted by: Filipe Silva
Date: December 13, 2018 12:29PM

Hi Arthur,

I'd say that it all depends on how your data looks like and what you do with it.

You will have to play around with the transaction isolation levels that best suites yours needs and if you use SELECT ... FOR SHARE queries mind that your code will have to be able to handle exceptions related to changing locked data and so. Note that you can also use the sub-options NOWAIT and SKIP LOCKED to help you avoid some concurrency issues.

Also, don't forget to turn autocommit off as all these options won't work otherwise.

With regard to thread-safe environment, again, it all depends on what you are doing with your data. I would say you don't need any special care other than don't use the same JDBC objects concurrently.

I don't think I can be of much more help. Please consult the MySQL documentation for all details.

Options: ReplyQuote


Subject
Written By
Posted
Re: Use MySql Update Lock or Java Thread-Safe???
December 13, 2018 12:29PM


Sorry, only registered users may post in this forum.

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.