![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I am using Connector/J [latest stable version] with MySQL 4.0.18 and InnoDB tables. My application occasionally performs such sequence of commands: Connection con = pool.getConnection(); con.setAutoCommit(false); Statement stmt = con.createStatement(); stmt.executeUpdate("update my_table set counter = counter + 1 where id = " + id); ... con.commit(); Is it possible that when this code snippet is performed by several threads at once, the "counter" increment is not done correctly? Because it is what happens to some rows of that table. Transaction isolation should be repeatable_read, as it is default for InnoDB. Or do I have to execute "select for update" first? |
![]() |
| Thread Tools | |
| Display Modes | |
| |