TRANSACTION MANAGEMENT USING JDBC Flashcards
What is a transaction and give examples of transactions
• Transaction represents a single unit of work
• Examples:
• In case of an ATM: Check balance, Withdraw
• In case of Database management: Update a table’s field data,
Add data item to a table in the DB
Describe the ACID properties of Transaction Management
• Atomicity means either all successful or none.
• Consistency ensures bringing the database from one consistent state to
another consistent state.
• Isolation ensures that transaction is isolated from other transaction.
• Durability means once a transaction has been committed, it will remain so,
even in the event of errors, power loss etc.
What is the advantage of transaction management
• Fast performance
• TM makes the performance fast because database is hit at the time of
commit.
What are the methods provided by the connection interface to manage transactions
void setAutoCommit(boolean status)- True by default means each transaction is committed by default
void commit()- commits the transaction
void rollback()- cancels the transaction
Draw a diagram representing the transaction model
*See notes for pic
Write code for the implementation of JDBC Transaction Management using Statement
*See notes for pic