TRANSACTION MANAGEMENT USING JDBC Flashcards

1
Q

What is a transaction and give examples of transactions

A

• 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe the ACID properties of Transaction Management

A

• 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the advantage of transaction management

A

• Fast performance
• TM makes the performance fast because database is hit at the time of
commit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the methods provided by the connection interface to manage transactions

A

void setAutoCommit(boolean status)- True by default means each transaction is committed by default

void commit()- commits the transaction

void rollback()- cancels the transaction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Draw a diagram representing the transaction model

A

*See notes for pic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Write code for the implementation of JDBC Transaction Management using Statement

A

*See notes for pic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly