我正在尝试使用Java和JDBC在MySQL中创建一个幻像读取。我有以下交易
交易1:
String[] querySetOne = new String[5];
querySetOne[0] = "use adventureworks";
querySetOne[1] = "select * from vendorcontact where ContactTypeID between 10 and 30";
querySetOne[2] = "select sleep(20)";
querySetOne[3] = "select * from vendorcontact where ContactTypeID between 10 and 30";
querySetOne[4] = "COMMIT";
交易2:
String[] querySetTwo = new String[4];
querySetTwo[0] = "use adventureworks";
querySetTwo[1] = "select sleep(2)";
querySetTwo[2] = "insert into vendorcontact values (105, 700, 20, NULL)";
querySetTwo[3] = "COMMIT";
我试图在可重复的读隔离级别上使用InnoDB数据库引擎创建一个幻像读取,但我现在的理解是MySQL使用快照隔离COMBINED与REPEATABLE READ和SERIALIZABLE隔离级别。 然后我将我的数据库引擎切换到MyISAM,发现它没有表现出任何并发控制;当我使用MyISAM时,在所有隔离级别上发生丢失更新,不可重复读取,脏读和幻像。我有几个问题:
答案 0 :(得分:1)
据我所知,MyISAM表忽略隔离级别设置。它是explicit on the 5.0 and 5.1 documentation,但它们似乎已经删除了对较新文档的InnoDB提及。