Sun River
Topics about Java SE, Servlet/JSP, JDBC, MultiThread, UML, Design Pattern, CSS, JavaScript, Maven, JBoss, Tomcat, ...
posts - 78,comments - 0,trackbacks - 0

--) Dirty Read? 
Dirty reads occur when transactions are allowed to see uncommitted changes to the data. In other words, changes made inside a transaction are visible outside the transactionbefore it is committed. If the changes are rolled back instead of being committed, it is possible for other transactions to have done work based on incorrect, transient data.

--) Nonrepeatable reads occur when:
 a) Transaction A reads a row

 b)Transaction B changes the row

 c)Transaction A reads the same row a second time and gets different results


--) Phantom reads occur when:  
a)Transaction A reads all rows that satisfy a WHERE condition   
b)Transaction B inserts an additional row that satisfies the same condition   
c)Transaction A reevaluates the WHERE condition and picks up the additional phantom row

--) READ_UNCOMMITTED?
By setting the isolation level to you are saying that you won't have a problem with reading data that might get rolled back. If this is unacceptable, use a more restrictive isolation level.

--) What is the default transaction isolation level ?
A. READ_UNCOMMITTED
B. READ_COMMITTED
C. REPEATABLE_READ
D. SERIALIZABLE
E. None of Above

Note:The Isolation level depends on the database in use.

  1. TRANSACTION_READ_UNCOMMITTED - allows transactions to see uncommitted changes to the data. This means that dirty reads, nonrepeatable reads, and phantom reads are possible.
  2. TRANSACTION_READ_COMMITTED - means that any changes made inside a transaction are not visible outside the transaction until the transaction is committed. This prevents dirty reads, but nonrepeatable reads and phantom reads are still possible.
  3. TRANSACTION_REPEATABLE_READ - disallows dirty reads and nonrepeatable reads. Phantom read are still possible.
  4. TRANSACTION_SERIALIZABLE - specifies that dirty reads, nonrepeatable reads, and phantom reads are prevented.
posted on 2006-09-18 11:08 Sun River 阅读(340) 评论(0)  编辑  收藏