Question: Write a Java program IsolationTest.java which opens two separate connections to a Mysql/MariaDB to this database. Make sure to have connection info pulled out into

Write a Java program IsolationTest.java which opens two separate connections to a Mysql/MariaDB to this database. Make sure to have connection info pulled out into a some changeable variables at the top of your program and have a README.txt file in your ZIP folding explaining what needs to be modified to connect to a different server. Set the isolation level for one connection to be read committed. Do this directly with an execute Update. Then do a sequence of interleaving operations between the two connections, printing to the screen what you are doing at each step. Your interleaving operations should be such that the connection which is in the read committed isolation level only performs reads, reads the same row thrice, but sees a different value each time. This is called an unrepeatable read. Next have your program close and reestablish the two connections. For the connection which only performed reads the first time, now set the isolation level to serializable. Have the program do the same interleaving now as the first time, printing the results to the screen. This time the subsequence of operations R_1(data), W_2(data), R_1 (data), the W_2(data) needs to wait for a lock, so will timeout. If you ran these transactions in threads, so your transaction 1 could continue, it should see the same read value thrice (I am not asking you to do your code in threads). Roughly, the same code should work for Postgres, Oracle, DB2, each of which also has a SET TRANSACTION ISOLATION LEVEL command. Do some experiments with your program demonstrating what was just described, explaining why your program does what it does, and write these up in Experiments .pdf . Include transcripts of your program running.

Step by Step Solution

3.34 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres a template for IsolationTestjava import javasql public class IsolationTest Define connection p... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!