5 messages in com.mysql.lists.javaRe: Synchronization of InnoDB transac...
FromSent OnAttachments
Filip Rachunek19 Dec 2003 01:29 
Dane Foster19 Dec 2003 10:42 
Filip Rachunek20 Dec 2003 06:37 
Mark Matthews20 Dec 2003 08:10 
Filip Rachunek21 Dec 2003 11:01 
Subject:Re: Synchronization of InnoDB transactions
From:Dane Foster (dfos@equitytg.com)
Date:12/19/2003 10:42:16 AM
List:com.mysql.lists.java

Filip Rachunek wrote:

Hello, I would like to find the best solution for this problem. I have a Java web application with Connector/J 3.0.9 and MySQL 4.0.16 with InnoDB database. When a specific action is requested, the application must perform the following sequence of operations: 1) Update or insert one or two rows in one table. 2) Read a set of rows from the same table, based on some WHERE and ORDER BY conditions. 3) Update values in one or two columns of all rows selected by the 2) action. All these points are parts of one transaction, of course. Is there a good way how to ensure that any other thread trying to perform the same transaction [with another insert/update values] will wait until the current transaction is done and commited? I've read the InnoDB manual but it contains many possibilities [lock tables, select * lock in share mode, select * for update, ...] and I am not sure which in is the best one, especially to prevent data corruption or deadlocks.

Thanks for all help. Filip

Set the isolation level on the server or for every connection to the database to SERIALIZABLE. But be warned, it can bring concurrency to a screeching halt.

Dane.