I am trying to demonstrate phantom reading in MySQL using JDBC. I understand that with the isolation level REPEATABLE-READ phantoms should be possible. But I can't make this happen. My transactions are configured as follows:
Transaction 1:
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";
Transaction 2:
querySetTwo[0] = "use adventureworks"; querySetTwo[1] = "select sleep(2)"; querySetTwo[2] = "insert into vendorcontact values (105, 700, 20, NULL)"; querySetTwo[3] = "COMMIT";
I use them in b / c arrays. I use the Statement.execute () method to execute each line, and I have autocommit set to false.
Why does a query from querySetOne [1] and querySetOne [3] return the same results according to read read repeatability
source share