HW10: Concurrent Bank Transactions due Mon 01 Apr 13:00

\begin{purpose}
This assignment provide substantial practice in writing JDBC co...
...base transactions
and table locking to produce a correct result.
\end{purpose}

Allowed and Disallowed Resources

In completing this assignment you MAY use/access the following resources:

You may NOT use/access:

Failure to abide by these guidelines will result in a zero for the assignment and the incident will be reported to the university provost as a violation of the university academic integrity policy. A second incident of academic dishonesty (whether from this course or another computer science course) will result in an F in the course.

Overview

In this assignment you are given a substantial amount of code that you are not allowed to modify. The driver simulates a significant number of concurrent bank transactions. When the driver finishes there should be 7 newly created accounts with the first account ending in $25.00 and the other accounts ending with $1,600.00. There are three main steps to completing the program:
  1. Take time to thoroughly read and understand the code provided (there is a lot of it!)
  2. In BankAccountDB.java write JDBC code to handle each of the possible transactions (create, deposit, withdraw, transfer). In this step do no worry about trying to deal with transactions and locking. You will see that your code is “correct” but that it gives incorrect results because of the overlapping database actions.
  3. Add the needed transaction/locking code to get correct results. Take care to not do locking unless it is needed.

Details

The starting code is provided in this repository:

https://tsergeant@bitbucket.org/tsergeant/db_bank_starter.git

These are the steps I would follow, but you can do things in whatever order you want:

  1. In bitbucket create a new repository by choosing the import option. Paste in the URL above. Make sure you mark it as a private repository.
  2. In the bitbucket repository settings share the repository with terrys@gmail.com
  3. In your local workspace (on your computer) clone your copy of the repository. Now you are ready to work on the code and your code will be turned in automatically when you do your final push to bitbucket.
  4. Read and understand the README file in the repository.
  5. Open the index.html file in the javadoc directory with your browser and get an overview of the project.
  6. Read the Transaction.java source code and then write a temporary driver to play around with it. Once you feel comfortable with how it behaves you are read to look at Driver.java.
  7. Execute the provided bank.sql file in your database to establish the bank_account table in a schema called bankdb.
  8. Read the Driver.java source code including the documentation to get a sense of what the driver is doing.
  9. If you need a refresher on some of the concepts you'll need take a look at the examples here: https://josephus.hsutx.edu/classes/db/source/transactions/
  10. One-by-one work on implementing each of the transactions in BankAccountDB.java. You'll need to modify Driver.java to comment out parts that are not working yet.
  11. Once the JDBC code is written and working, add transactions and locking to get the expected results.

IMPORTANT: Each transaction should correctly set the result attribute in the provided Transaction object. If funds are insufficient for a transfer then no part of the transfer should take place. If funds are insufficient for a withdrawal then the withdrawal should not take place. When creating a new account you should use sequences/nextval to ensure each account gets a unique id number. DO NOT CHANGE any of the provided source code (except, of course, for BankAccountDB.java).

Submission and Grading

Turn in your program by sharing with me your bitbucket (private) copy of the repository and making sure your code is pushed by the due date.

Your program will be graded as follows:

Correct Create 6 pts
Correct Deposit 3 pts
Correct Withdraw 3 pts
Correct Transfer 6 pts
Correct/Efficient Locking 12 pts
Total 30 pts