<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    lqxue

    常用鏈接

    統(tǒng)計(jì)

    book

    tools

    最新評(píng)論

    Transaction Isolation Levels

    Transaction Isolation Levels


    Overview

    The ANSI/ISO SQL standard defines four levels of transaction isolation in terms of three potential problems that must be prevented between concurrent transactions. These problems are:

    • Dirty Read - A transaction reads data written by another concurrent uncommitted transaction.

    • Non-Repeatable Reads - A transaction re-reads data it has previously read and finds that data has been modified by another transaction (one that has been committed since the transaction's previous read).

    • Phantom Read - A transaction re-executes a query returning a set of rows that satisfy a search condition and finds that the set of rows satisfying the condition has changed due to another recently-committed transaction.

    Transaction Isolation Levels

    The four levels of transaction isolation are:

    • Uncommitted Read

    • Committed Read

    • Repeatable Read

    • Serializable.

    The isolation level that your transaction runs in determines how sensitive your application is to changes other users' transactions make, and consequently, how long your transaction must hold locks to protect against these changes. The ANSI SQL standard defines four levels of transaction isolation.

    Uncommitted Read

    Uncommitted Read, or dirty read, lets a transaction read any data currently on a data page, regardless of whether or not the data has been committed. For example, another user might have a transaction in progress that has updated data, and that transaction is holding exclusive locks on the data. Your transaction can read the data anyway, and possibly take further actions based on the values you read. The other user might then decide to roll back their transaction, so logically, those changes never occurred.

    Committed Read

    Committed Read ensures that an operation will never read data another application has changed but not yet committed. Because you can never read uncommitted data, if a transaction running with Committed Read isolation revisits data, that data might have changed, or new rows might appear that meet the criteria of the original query. Rows that appear in this way are called phantoms.

    Repeatable Read

    If you want the read operations to be repeatable, choose the third isolation level. The Repeatable Read isolation level adds to the properties of Committed Read by ensuring that if a transaction revisits data or if a query is reissued, the data will not have changed. In other words, issuing the same query twice within a transaction will not pick up any changes to data values that another user's transaction has made. No other user can modify the data that your transaction visits as long as you have not yet committed or rolled back your transaction.

    Serializable

    The Serializable isolation level ensures that if a query is reissued, no data will have changed and no new rows will appear in the interim. In other words, you will not see phantoms if the same query is issued twice within a transaction.

    Transaction isolation Levels Behavior

    The four transaction isolation levels and the corresponding behaviors are described below:

    Isolation Level

    Dirty Read

    Non-Repeatable Read

    Phantom Read

    Read Uncommitted

    Possible

    Possible

    Possible

    Read Committed

    Not possible

    Possible

    Possible

    Repeatable Read

    Not possible

    Not possible

    Possible

    Serializable

    Not possible

    Not possible

    Not possible



    Support for Transaction Isolation Levels in Orbix E2A Application Server

    With Orbix E2A Application Server, you can specify the transaction isolation level for an entire EJB in an application's cc.xml file by setting the new <connection-tx-isolation-level> element in the relevant <resource-ref> and <cmp-datasource> elements.

    The valid values for the <connection-tx-isolation-level> element are:

    • TRANSACTION_READ_UNCOMMITTED

    • TRANSACTION_READ_COMMITTED

    • TRANSACTION_REPEATABLE_READ

    • TRANSACTION_SERIALIZABLE

    The following is an extract of a cc.xml file using transaction isolation levels for the Account and Person demos that ship with Orbix E2A Application Server.

     

    <configuration>
                <enterprise-beans>
                <entity>
                <ejb-name>Account</ejb-name>
                <jndi-name>iona/ipas/simple/Account</jndi-name>
                <jndi-source-name>CosNaming</jndi-source-name>
                <resource-ref>
                <res-ref-name>jdbc/Accounts</res-ref-name>
                <res-ref-link>JDBCAccounts</res-ref-link>
                <connection-tx-isolation-level>TRANSACTION_READ_COMMITTED
                </connection-tx-isolation-level>
                </resource-ref>
                </entity>
                <entity>
                <ejb-name>Person</ejb-name>
                <jndi-name>iona/ipas/simple/Person</jndi-name>
                <jndi-source-name>CosNaming</jndi-source-name>
                <cmp-datasource>
                <res-ref-name>jdbc/Person</res-ref-name>
                <res-ref-link>JDBCPerson</res-ref-link>
                <connection-tx-isolation-level>TRANSACTION_SERIALIZABLE
                </connection-tx-isolation-level>
                </cmp-datasource>
                ...
                </entity>
                </enterprise-beans>
                <resources>
                <resource>
                <resource-name>JDBCPerson</resource-name>
                <jndi-name>iona:cloudscape/demos</jndi-name>
                </resource>
                <resource>
                <resource-name>JDBCAccounts</resource-name>
                


     

         <jndi-name>iona:cloudscape/demos</jndi-name>
                </resource>
                </resources>
                ...
                </configuration>
                

     



             What are Transactions?

    A transaction is unit of work containing activities that need to be completed together. For instance, for an online travel site, you might have a session bean method bookTravel that takes a credit card, ensures its valid, charges the price of the ticket on the credit card, and books the ticket. This method invoke methods on other EBJs to help accomplish these steps. For instance, methods of Customer, CreditCard and AirlineTicket beans will be invoked during the execution of this method. If all these steps complete successfully, the transaction succeeds. If any of these steps fails, the entire transaction fails and any changes made by previous steps are rolled back. For instance, if the ticket price is charged on the credit card, but booking the ticket fails, the charge on the credit card must be undone.

    If all activities that make up the transaction execute successfully, all changes that were made as part of the transaction are committed. If the transaction fails, these changes are rolled back.

    Reliable transactions have the following properties:


    http://www.iona.com/support/docs/e2a/asp/5.0/j2ee/DevelopGuide/html/Jta-Bas5.html

    posted on 2007-06-29 15:59 lqx 閱讀(230) 評(píng)論(0)  編輯  收藏


    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 国产精品永久免费10000| 亚洲综合色丁香麻豆| 欧美日韩国产免费一区二区三区| xxxxxx日本处大片免费看| 亚洲伊人久久大香线蕉AV| 国产亚洲av片在线观看播放 | 亚洲区小说区激情区图片区| 四虎成人免费大片在线| 四虎永久在线精品免费观看视频| 亚洲精品无码永久在线观看你懂的| 日韩在线a视频免费播放| 波多野结衣中文字幕免费视频| 久久美女网站免费| 成在线人视频免费视频| 羞羞视频在线免费观看| 亚洲精品无码专区| 亚洲高清中文字幕免费| 亚洲另类自拍丝袜第1页| 亚洲视频在线观看免费视频| 久久精品国产99精品国产亚洲性色 | 亚洲中文字幕无码爆乳av中文 | www成人免费视频| 国产亚洲漂亮白嫩美女在线| 亚洲国产成人久久一区二区三区| 亚洲国产最大av| 亚洲 日韩经典 中文字幕| 性xxxx黑人与亚洲| 亚洲天堂2016| 久久亚洲精品国产精品婷婷| 亚洲精品亚洲人成在线播放| 亚洲最大成人网色香蕉| 亚洲欧美精品午睡沙发| 亚洲AV无码国产剧情| 18禁亚洲深夜福利人口| 爱爱帝国亚洲一区二区三区| 精品亚洲福利一区二区| 美女视频黄.免费网址| 色爽黄1000部免费软件下载| 国产va免费精品| 亚洲精品国产日韩| 亚洲一卡2卡3卡4卡5卡6卡 |