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:
- Take time to thoroughly read and understand the code provided (there is
a lot of it!)
- 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.
- Add the needed transaction/locking code to get correct results. Take
care to not do locking unless it is needed.
The starting code is provided in this repository:
These are the steps I would follow, but you can do things in whatever order you want:
- 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.
- In the bitbucket repository settings share the repository with email@example.com
- 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.
- Read and understand the README file in the repository.
- Open the index.html file in the javadoc directory with your
browser and get an overview of the project.
- 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.
- Execute the provided bank.sql file in your database to establish the
bank_account table in a schema called bankdb.
- Read the Driver.java source code including the documentation to get a
sense of what the driver is doing.
- 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/
- 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
- 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).
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: