<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)航:
     
    主站蜘蛛池模板: 好紧我太爽了视频免费国产| 亚洲av一综合av一区| 100部毛片免费全部播放完整| 国产成人综合亚洲一区| 免费av片在线观看网站| 老外毛片免费视频播放| 亚洲熟妇AV乱码在线观看| 久久久久亚洲精品日久生情 | 亚洲春色另类小说| 亚洲欧洲无码AV电影在线观看| 日韩电影免费在线观看视频 | 国产成+人+综合+亚洲专| 国产精品公开免费视频| 久久久久久免费视频| 95老司机免费福利| 日本亚洲欧洲免费天堂午夜看片女人员| 香港特级三A毛片免费观看| 亚洲欧美国产国产综合一区| 亚洲一区中文字幕在线观看| 亚洲高清中文字幕综合网| 久久国产精品亚洲一区二区| 亚洲中文字幕久久精品无码APP| 亚洲 国产 图片| 又大又硬又爽免费视频| 国产免费卡一卡三卡乱码 | 男男gvh肉在线观看免费| 亚洲七久久之综合七久久| 亚洲欧洲另类春色校园网站| 亚洲国产高清视频在线观看| 亚洲成A∨人片在线观看无码| 亚洲韩国在线一卡二卡| 亚洲精品视频在线观看视频| 亚洲综合图片小说区热久久| 亚洲高清无在码在线电影不卡| 亚洲视频在线免费播放| 亚洲成a人不卡在线观看| 亚洲国产精品成人久久久| 亚洲一级片在线观看| 亚洲人成网站在线播放2019| 亚洲欧美成人av在线观看| 婷婷亚洲综合五月天小说在线|