Java Reference
In-Depth Information
Now let's say one of those additions failed, say step 3 (table 7.6).
Table 7.6
Nonatomic transaction
Transaction state
Operation
Initial State
10
Step 1
+ 30
Step 2
+ 45
Failed Step 3
+ 15
End State
= 85
The data is incorrect because one of the steps in the transaction failed (table 7.7).
Table 7.7
Atomic transaction
Transaction state
Operation
Initial State
10
Step 1
+ 30
Step 2
+ 45
Failed Step 3
+ 15
Rolled Back Initial
State
= 10
In a system that guarantees atomicity, none of the operations would be per-
formed, and the data in the database would not be impacted.
Consistency
Many good database schemas define constraints to ensure integrity and consis-
tency. The ACID feature called consistency requires that at both the beginning and
the end of a transaction the database must be in a consistent state. A consistent
state is defined as one whereby all constraints—including integrity constraints,
foreign keys, and uniqueness—are met.
Isolation
Databases are often centralized resources shared by a number of users. It doesn't
matter how many users you have; if there's more than one user, it becomes very
important to keep transactions from conflicting with each other. The ACID feature
Search WWH ::




Custom Search