This is an example of a optimistic transaction using TiDB and plain Java and JDBC.
- Makefile(recommend)
- Run
make all
- Manual
- Run
mvn clean packageto clean and package JAR file. - Run
tiup demo bookshop prepare --drop-tables --books 0 --authors 0 --orders 0 --ratings 0 --users 0to create the data structure only. - Run
java -jar target/plain-java-txn-optimistic-0.0.1-jar-with-dependencies.jar ALICE_NUM=4 BOB_NUM=6to check not oversell example output. - Run
tiup demo bookshop prepare --drop-tables --books 0 --authors 0 --orders 0 --ratings 0 --users 0to create the data structure again. - Run
java -jar target/plain-java-txn-optimistic-0.0.1-jar-with-dependencies.jar ALICE_NUM=4 BOB_NUM=6to check oversell example output.