Isolation level serializable + EntityFramework 6.0 Concurrent Add

Hi!
I'm new to database programming and entity framework and currently running into
some database behavior I don't understand. Maybe someone can explain it to me?
I'm using a very simple table to isolate the behavior:
ID(Primary Key), SSI(Indexed, duplicates allowed)
        static void AddTalkgroups(object state)
            for (int i = 0; i < 1000; i++)
                Talkgroup talk = new Talkgroup();
                talk.ID = Guid.NewGuid();
                talk.SSI = i;
                using (var context = new LeitstelleContext())
                    using (var transaction = context.Database.BeginTransaction(System.Data.IsolationLevel.Serializable))
                       // context.Database.Log = ShowCache;
                        try
                            if (context.Talkgroups.SingleOrDefault(t => t.SSI == i) == null)
                                context.Talkgroups.Add(talk);
                                context.SaveChanges();
                            transaction.Commit();
                            Console.Write("+");
                        catch (Exception e)
                            transaction.Rollback();
                            Console.Write("-");
If I start the method in 2 concurrent threads, one of both will run into deadlocks
over and over again. As intended, no duplicates of SSI are added, but I don't understand
the database behavior.(The deadlocks)
As far as I understand. The database should place a RangeI-N lock on datasets
not found in the table during the "transaction" so no other transactions would be able
to add a new dataset matching the "select"-statement of the active transaction.
If I issue a "sp_lock" command during the transaction I'm seeing some RangeS-S locks.
thanks alot for looking into this!
best regards
Johnny

Hi David!
If I just switch to IsolationLevel.ReadCommited I get 968 duplicates in
my example. (And no PK violations)
Talkgroup.Id  = PrimaryKey
Talkgroup.Ssi is configured as "ununique index" in the SQL-Server 2012.
class Program
        static object lockobject = new object();
        static Barrier barrier = new Barrier(3);
        static void Main(string[] args)
            LeitstelleContext context = new LeitstelleContext();
            //Talkgroup talk = new Talkgroup();
            //talk.ID = Guid.NewGuid();
            //talk.SSI = 1234;
            //context.Talkgroups.Add(talk);
            //context.SaveChanges();
            context.Database.ExecuteSqlCommand("delete Talkgroups");
            DateTime start = DateTime.Now;
            System.Threading.ThreadPool.QueueUserWorkItem(AddTalkgroups);
            System.Threading.ThreadPool.QueueUserWorkItem(AddTalkgroups);
            barrier.SignalAndWait();
            Console.WriteLine(DateTime.Now.Subtract(start).TotalSeconds.ToString());
            var liste = context.Talkgroups.GroupBy(t => t.SSI).Where(mygroup => mygroup.Count() > 1);
            Console.WriteLine(liste.Count().ToString());
            //foreach (var item in liste)
            //    Console.WriteLine(item.Key);
            Console.ReadLine();
        static void AddTalkgroups(object state)
            for (int i = 0; i < 1000; i++)
                ////context.Database.Log = ShowCache;
                //Parallel.For(6500, 7500, i =>
                Talkgroup talk = new Talkgroup();
                talk.ID = Guid.NewGuid();
                talk.SSI = i;
                using (var context = new LeitstelleContext())
                    using (var transaction = context.Database.BeginTransaction(System.Data.IsolationLevel.ReadCommitted))
                       // context.Database.Log = ShowCache;
                        try
                            if (context.Talkgroups.SingleOrDefault(t => t.SSI == i) == null)
                                context.Talkgroups.Add(talk);
                                context.SaveChanges();
                            transaction.Commit();
                            Console.Write("+");
                        catch (Exception e)
                            transaction.Rollback();
                            Console.Write("-");
            barrier.SignalAndWait();
br
Johnny

Similar Messages

  • Writing BLOB under Trasnaction Isolation level Serializable

    I am trying to update a BLOB datatype using JDBC.
    Steps:
    1. Select the Row FOR UPDATE
    2. Get hold of BLOB Object
    3. Get Binary Ouput Stream
    4. Write to Output Stream
    This is being done inside a bigger Trasnaction. This is working fine when Transaction Isolation level is READ COMMITTED.
    But when I am using Transaction Isolation level SERIALIZABLE, it behave in very inconsistent manner.
    Sometimes it gets updated. Other times, it gives an error stating 'Cannot serialize this Transaction'.
    Whats the reason and possible solution?

    Hi Kamal,
    The SERIALIZABLE degree of isolation has its own limitations and one of them is the ORA-08177 error. This message is displayed whenever an attempt is made to update a row that has changed since your transaction began.
    So probably you should be looking if there are transactions that are simultaneously trying to update the same row. I don't think you need simulataneous access for a row if you are doing SERIALIZABLE transaction.This link would be helpful to you.
    http://asktom.oracle.com/pls/ask/f?p=4950:8:11007064320210057726::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:3233191441609
    perhaps if you post part of your code here which does the update then we might be able to help you more.
    Thanks,
    khalid

  • Problems in using isolation level serializable

    Dear everyone:
    This is the problem I met while using isolation level
    serializable in ORALCE 8.0.3 for Netware:
    Program 1 Program2
    Insert record 1 into table 1
    select record 1 from table1
    commit
    select record1 from table1
    insert record 2 into table1
    select record2 from table1
    commit
    select record2 from table1
    update record2 from table1
    commit
    delete record2 from table1
    commit
    update record1 from table1
    *ORA-8177 cannot serialize
    access for this transaction
    According to my understanding to the serialization isolation
    level, it should not occurs.
    Anyone can give me some ideas?
    Regards!
    null

    Dear everyone:
    This is the problem I met while using isolation level
    serializable in ORALCE 8.0.3 for Netware:
    Program 1 Program2
    Insert record 1 into table 1
    select record 1 from table1
    commit
    select record1 from table1
    insert record 2 into table1
    select record2 from table1
    commit
    select record2 from table1
    update record2 from table1
    commit
    delete record2 from table1
    commit
    update record1 from table1
    *ORA-8177 cannot serialize
    access for this transaction
    According to my understanding to the serialization isolation
    level, it should not occurs.
    Anyone can give me some ideas?
    Regards!
    null

  • Isolation level SERIALIZABLE problem

    Hi there,
    I have a problem with my stored procedures when the isolation level of the connection is serializable. I need to set this isolation level because of data consistency reasons.
    When in this isolation level and a transaction tries to update or delete data modified by a transaction that commits after the serializable transaction began, I get this error:
    ORA-08177: Cannot serialize access for this transaction
    This is normal. The thing to do in this case is catch the error in the exception handler, rollback to a certain savepoint and try to do the update again.
    The stored procedure that I use to test this is:
    CREATE OR REPLACE PROCEDURE nm_test IS
    tmpVar NUMBER;
    err_num NUMBER;
    err_msg VARCHAR2(200);
    teller number;
    BEGIN
    teller := 0;
    savepoint sp1;
    <<try_every_thing_again>>
    begin
    tmpVar := 0;
    update stock_prices set price = price + 1
    where ric = 1;
    DBMS_OUTPUT.Put_Line('teller = ' || teller);
    EXCEPTION
    WHEN others THEN
    err_num := SQLCODE;
    --err_msg := SUBSTR(SQLERRM, 1, 200);
         if (err_num = -8177) then
              rollback to savepoint sp1;
              --DBMS_LOCK.SLEEP(1);
              teller := teller + 1;
              if (teller < 10) then
                   goto try_every_thing_again;
              end if;
              DBMS_OUTPUT.Put_Line('exception: teller = ' || teller);
         end if;
    end;
    END nm_test;
    I test this using 2 connections to the database. In the first connection I run the stored proc (without committing). Then I run the same stored proc in the second connection. This will block on the update (the is an implicit lock), which is ok. Then I commit the first connection. The second catches the error, rolls back and tries the update again....but then it catches the exception again, and again???
    When I replace the "rollback to savepoint" by just "rollback", everything works fine (the exception is then caught only once) and the update succeeds on the second try.
    But I can not work with just a "rollback" because my stored procedures might be called by others for which I don't want to undo all the work.
    Do any of you know why I keep getting this error (the program ends up in an infinite loop if I didn't keep a counter and exit after 10 times)?
    Marcel van Vuure

    Marcel,
    First of all, I'd be interested in hearing why you think you need serializable transactions (why 'read committed' doesn't work for your application). In the 8 years I've been building Oracle apps, I've never deemed it necessary to use serializable transactions. Maybe an optimistic locking strategy will solve your problem.
    Secondly, if I were designing the interface, I wouldn't have a procedure in charge of both executing business logic AND retrying the logic in case of failure. I'd build a helper procedure that calls the procedure that does the work, looks for certain exceptions, and retries the procedure when necessary.
    Lastly, if your interface doesn't have transactional control (the caller is in charge of commits and rollbacks), maybe you should simply attempt the update statement and throw an exception to the caller and let them handle it.
    I'm sorry if I haven't directly solved your problem, but sometimes the best way to solve a problem is to question the decisions that got you there in the first place.
    Hi there,
    I have a problem with my stored procedures when the isolation level of the connection is serializable. I need to set this isolation level because of data consistency reasons.
    When in this isolation level and a transaction tries to update or delete data modified by a transaction that commits after the serializable transaction began, I get this error:
    ORA-08177: Cannot serialize access for this transaction
    This is normal. The thing to do in this case is catch the error in the exception handler, rollback to a certain savepoint and try to do the update again.
    The stored procedure that I use to test this is:
    CREATE OR REPLACE PROCEDURE nm_test IS
    tmpVar NUMBER;
    err_num NUMBER;
    err_msg VARCHAR2(200);
    teller number;
    BEGIN
    teller := 0;
    savepoint sp1;
    <<try_every_thing_again>>
    begin
    tmpVar := 0;
    update stock_prices set price = price + 1
    where ric = 1;
    DBMS_OUTPUT.Put_Line('teller = ' || teller);
    EXCEPTION
    WHEN others THEN
    err_num := SQLCODE;
    --err_msg := SUBSTR(SQLERRM, 1, 200);
         if (err_num = -8177) then
              rollback to savepoint sp1;
              --DBMS_LOCK.SLEEP(1);
              teller := teller + 1;
              if (teller < 10) then
                   goto try_every_thing_again;
              end if;
              DBMS_OUTPUT.Put_Line('exception: teller = ' || teller);
         end if;
    end;
    END nm_test;
    I test this using 2 connections to the database. In the first connection I run the stored proc (without committing). Then I run the same stored proc in the second connection. This will block on the update (the is an implicit lock), which is ok. Then I commit the first connection. The second catches the error, rolls back and tries the update again....but then it catches the exception again, and again???
    When I replace the "rollback to savepoint" by just "rollback", everything works fine (the exception is then caught only once) and the update succeeds on the second try.
    But I can not work with just a "rollback" because my stored procedures might be called by others for which I don't want to undo all the work.
    Do any of you know why I keep getting this error (the program ends up in an infinite loop if I didn't keep a counter and exit after 10 times)?
    Marcel van Vuure

  • XI JDBC adapter isolation level serializable - Not working properly????

    Hi all,
      I have a JDBC sender adapter which perform in Transaction isolation Method serializable(Advance Mode settings) but it seems that it updates the wrong records witch results in records no to be send in XI.
    the select statement I am using is
    select OwnerCode,DeliveryNo , ErpWarehouseCode, TrtCode, PostGIdate, PostGIdateChangedFlg, DocumentNo, DocumentDate, CancelFlg,  PostGIFlg, TacticalRouteCode, LicenceNo, PackagesQty, CusPickUpFlg, CusPickUpChangedFlg,  RouteChangedFlg, DlvPriority, PickingDate, PickingDateChangedFlg, DlvPriorityChangedFlg, OdtLineNumber, ItemCode,  WmsStatusCode, Lot, ExpirationDate,ProductionDate, TraUnitQty, TraUnitCode, Qty, MainUnitCode, ConvFactor, ConvDivisor, InitQty, DocQty, DeleteLineFlg, ParentLineNumber, ItemType, CusPickUpDescr, CusPickUpChangedFlg2  
    from wmsConfDlv2ERP
    where flg = 0 and
             DeliveryNo in ( select top 1 DeliveryNo from wmsConfDlv2ERP where flg = 0 )
    and the update is
    UPDATE wmsConfDlv2ERP set flg = -1
    where flg = 0 and
              DeliveryNo in ( select top 1 DeliveryNo from  wmsConfDlv2ERP where flg = 0  )
    Any ideas? The DB is an MS SQL 2005... Thanks.

    Hi,
    As far as I know, the JDBC adapter does not support nested queries (just my experience). I always used SPs to properly handle the situation and flow logic.
    VJ

  • Isolation Level bug

    ODP.Net ignores the Isolation level of the ambient transaction (TransactionScope). ODP always use ReadCommitted. When the connection string option
    Promotable Transaction = local
    ODP internally creates an OracleTransaction. Looking inside the OracleConnection.Open method you can see something like this
    this.m_oraTransaction = this.BeginTransaction();
    BeginTransaction use de default Oracle Isolation level which is ReadCommited.
    With a real distributed transacton it's no easy to see the bug but I get the same problem: always ReadCommitted.

    This is my DBConnectionManager class. I tried to solve this problem just changing DBConnectionManager, transparent to application.
    public class DBConnectionManager
    private static List<string> _transacciones = new List<string>();
    public static OracleConnection GetConnection()
    SetProperIsolationLevel();
    return new OracleConnection(GetConnectionString());
    private static string GetConnectionString()
    return ConfigurationManager.AppSettings["ConnectionString"];
    private static void SetProperIsolationLevel()
    if((Transaction.Current !=null)&&(Transaction.Current.IsolationLevel == System.Transactions.IsolationLevel.Serializable) && !_transacciones.Contains(Transaction.Current.TransactionInformation.LocalIdentifier))
    OracleConnectionStringBuilder csBuilder = new OracleConnectionStringBuilder(GetConnectionString());
    csBuilder.Pooling = false;
    OracleConnection conn = new OracleConnection(csBuilder.ConnectionString);
    conn.Open();
    OracleCommand cmd = null;
    try
    cmd = conn.CreateCommand();
    cmd.CommandType = CommandType.Text;
    cmd.CommandText = "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE";
    cmd.ExecuteNonQuery();
    transacciones.Add(Transaction.Current.TransactionInformation.LocalIdentifier);
    Transaction.Current.TransactionCompleted += delegate(object sender, TransactionEventArgs e)
    _transacciones.Remove(e.Transaction.TransactionInformation.LocalIdentifier);
    finally
    if(cmd != null)
    cmd.Dispose();
    conn.Dispose();
    }

  • How do you determine a process or sessions isolation level.

    We are using COM+ components to issue database statements against an Oracle 8i database. COM+ has a property that allows you to set the isolation level. Is there any tool or query that would allow me to verify the isolation level in use by a session or process? I want to verify this property is actually affecting the connection to the DB.
    Thanks,
    Sam

    FLAG is just one of those columns that Oracle uses. It isn't documented but, as far as I know (which isn't very far), the only use for it is to record the isolation level for the transaction.
    I didn't mention it because I didn't think it helped you, for this reason: we don't get a record in the v$transaction view until the transaction has already started. At which point it is too late to change the ISOLATION_LEVEL for the transaction.
    Although I suppose you could do this:
    BEGIN
       UPDATE dummy_table set col1 = col1;
       -- remember V$TRANSACTION shows all txns
       SELECT count(1) INTO ln
       FROM   v$transaction t, v$session s
       WHERE  bitand(t.flag,268435456) <> 0
       AND    s.taddr = t.addr
       AND    s.audsid = sys_context('userenv', 'sessionid');
       IF ln = 0
       THEN
          ROLLBACK;
          SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
       END IF;
       --  do_whatever
       COMMIT;
    END ;.
    Cheers, APC

  • Setting transaction isolation level in Weblogic 5.1

              Hi,
              I'm using Weblogic server5.1 and i'm trying to set the isolation level on one
              of my session bean. Below is the code :
              <weblogic-ejb-jar>
              <weblogic-enterprise-bean>
              <ejb-name>chargeMgr</ejb-name>
              <jndi-name>chargeMgr</jndi-name>
              <transaction-isolation>
              <isolation-level>Serializable</isolation-level>
              <method>
              <ejb-name>chargeMgr</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>*</method-name>
              </method>
              </transaction-isolation>
              </weblogic-enterprise-bean>
              </weblogic-ejb-jar>
              I have checked the syntax against the weblogic documentation.
              However, when i try to jar the beans up into the jar file (weblogic.ejbc), it
              give me the following error :
              org.xml.sax.SAXParseException: Element "weblogic-enterprise-bean" allows no further
              input; "transaction-isolation" is not allowed.
              Can anyone help?
              Regards.
              

    yes, only in weblogic-ejb-jar.xml , and you can see that from the DTD
              source.
              thanks
              Yu
              "cw lee" <[email protected]> wrote in message
              news:[email protected]...
              >
              > thanks for ur advice.
              >
              > one thing i forgot to mention is that the isolation-level was specified in
              weblogic-ejb-jar.xml.
              > Do u mean that it must be placed in weblogic-cmp-rdbms-jar.xml and not
              weblogic-ejb-jar.xml
              > ?
              >
              > Are the codes u suggested to be in weblogic-ejb-jar.xml or
              weblogic-cmp-rdbms-jar.xml
              > ?
              >
              > Regards.
              >
              >
              >
              > "Yu Tian" <[email protected]> wrote:
              > >the right name for Seriealizable should be: TRANSACTION_SERIALIZABLE.
              > >so the
              > >DD looks like:
              > >
              > ><?xml version="1.0"?>
              > >
              > ><!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic
              > >5.1.0
              > >EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'>
              > >
              > ><weblogic-ejb-jar>
              > > <weblogic-enterprise-bean>
              > > <ejb-name>containerManaged</ejb-name>
              > > <caching-descriptor>
              > > <max-beans-in-cache>1000</max-beans-in-cache>
              > > </caching-descriptor>
              > > <persistence-descriptor>
              > > <persistence-type>
              > > <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
              > > <type-version>5.1.0</type-version>
              > > <type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
              > > </persistence-type>
              > > <persistence-use>
              > > <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
              > > <type-version>5.1.0</type-version>
              > > </persistence-use>
              > > </persistence-descriptor>
              > > <jndi-name>containerManaged.AccountHome</jndi-name>
              > > <transaction-isolation>
              > > <isolation-level>TRANSACTION_SERIALIZABLE</isolation-level>
              > > <method>
              > > <ejb-name>containerManaged</ejb-name>
              > > <method-name>*</method-name>
              > > </method>
              > > </transaction-isolation>
              > > </weblogic-enterprise-bean>
              > > </weblogic-ejb-jar>
              > >
              > >Thanks
              > >
              > >Yu
              > >
              > >
              > >"cw lee" <[email protected]> wrote in message
              > >news:[email protected]...
              > >>
              > >> Hi,
              > >>
              > >> I'm using Weblogic server5.1 and i'm trying to set the isolation level
              > >on
              > >one
              > >> of my session bean. Below is the code :
              > >>
              > >> <weblogic-ejb-jar>
              > >> <weblogic-enterprise-bean>
              > >> <ejb-name>chargeMgr</ejb-name>
              > >> <jndi-name>chargeMgr</jndi-name>
              > >> <transaction-isolation>
              > >> <isolation-level>Serializable</isolation-level>
              > >> <method>
              > >> <ejb-name>chargeMgr</ejb-name>
              > >> <method-intf>Remote</method-intf>
              > >> <method-name>*</method-name>
              > >> </method>
              > >> </transaction-isolation>
              > >> </weblogic-enterprise-bean>
              > >> </weblogic-ejb-jar>
              > >>
              > >> I have checked the syntax against the weblogic documentation.
              > >> However, when i try to jar the beans up into the jar file
              (weblogic.ejbc),
              > >it
              > >> give me the following error :
              > >>
              > >> org.xml.sax.SAXParseException: Element "weblogic-enterprise-bean"
              allows
              > >no further
              > >> input; "transaction-isolation" is not allowed.
              > >>
              > >> Can anyone help?
              > >>
              > >> Regards.
              > >>
              > >
              > >
              >
              

  • Transaction Isolation Levels

    Hi Everyboody.
    Oracle docs. say that Oracle supports three isolation levels and the isolation level should be set before the transaction begins with the SET TRANSACTION ISOLATION LEVEL .....
    Resource: http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/server.920/a96524/c21cnsis.htm#2641
    But I find that Oracle 9i supports only two isolation levels, viz. Read Committed and Serializable.
    SQL> SET TRANSACTION ISOLATION LEVEL READ ONLY
    2 ;
    SET TRANSACTION ISOLATION LEVEL READ ONLY
    ERROR at line 1:
    ORA-02179: valid options: ISOLATION LEVEL { SERIALIZABLE | READ COMMITTED }
    Is READ ONLY isolatin level avalilable in Oracle 9i or is there any problem with my SET instruction?
    Please help me at the earliest.
    Have a nice day!
    Kishore

    Thanks Dmitry.
    It works.
    Continuing on the same thread, I would like to know what is the difference between READ COMMITTED and SERIALIZABLE isolation levels?
    Thank you for your reply.
    Kishore.

  • How to set the isolation level on Entity EJBs

    I am using 10.1.3.3 of the OC4J app server.
    I am creating an application that uses EJB 2.1.
    I am trying to set the isolation levels on the EJBs to either serializable or repeatable read.
    When i deploy the EAR file from the OC4J admin console, i can set the isolation level property on the EJB's however when i inspect the orion-ejb-jar.xml file I do not see the isolation level being set. Furthermore, i tried to manually change the isolation setting by editing the orion-ejb-jar.xml and adding the isolation="serialiable" attribute on the entity bean descriptor. I then stopped and restarted the server. I noticed that my change was no longer in the file.
    Can someone please let me know how to solve this problem and set the isolation level on Entity EJBs . Thanks

    I find it at ejb.pdf from BEA.
              The transaction-isolation stanza can contain the elements shown here:
              <transaction-isolation>
              <isolation-level>Serializable</isolation-level>
              <method>
              <description>...</description>
              <ejb-name>...</ejb-name>
              <method-intf>...</method-intf>
              <method-name>...</method-name>
              <method-params>...</method-params>
              </method>
              </transaction-isolation>
              "Hyun Min" <[email protected]> wrote in message
              news:3c4e7a83$[email protected]..
              > Hi!
              >
              > I have a question.
              > How to set the transaction isolation level using CMT in descriptor?
              >
              > The Isolation level not supported in CMT?
              >
              > Thanks.
              > Hyun Min
              >
              >
              

  • Setting Isolation levels

    We have a window service which is responsible to send SMS to users.
    We have 20 instance running as a window service which hits a single table “Tab1”.
    I have implemented isolation level – “SET TRANSACTION ISOLATION LEVEL SERIALIZABLE”, but it is not working because 20 instance is reading a single record at the same time and thus sending 20 SMS to single user.
    I want that if 20 instances read the same record, only one should send the SMS and not all.
    Please advice what can be done..
    We have these 20 instances to speed up the process of sending SMS from the table... so we cannot just rely on one service

    SERIALIZABLE only means that until you commit, SQL Server guarantees that the result set will be the same if you repeat the query. It does not perform any updates or lock a row for reacing by other users.
    It sounds like you have some sort of a queue. Thus, you should look into Service Broker.
    In the meanwhile you can try:
    BEGIN TRANSACTION
    SELECT TOP(1) .... FROM SMS_table WITH (READPAST)
    -- Send your SMS here
    UPDATE tbl SET fetched = 1 WHERE ...
    COMMIT TRANSACTIOn
    Don't use SERIALIZABLE, but stick to READ COMMITTED.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Serializable transaction isolation level bugs

    Hello!
    I would like to know which versions of Oracle database are free or not free of serializable transaction isolation level bugs.
    Especially I'm interested in all informations about 440317 bug which is described here: Bug in Oracle's handling of transaction isolation levels?
    Thank you very much.

    If you are genuinely suffering from 440317 (and not poor design which is the most common cause of ORA-8177, and hence why it's taken so long for this bug to get fixed - originally raised in 7.2.2 !!!) then you will have to wait until 10g R2 sees the light of day.
    Cheers, APC

  • XA and SERIALIZABLE isolation level

    Hi,
    I'm using JDBC with oracle DB 8.1.6. When I get the physical connection and set transaction isolation level to TRANSACTION_SERIALIZABLE then issue start() on the XAResource instance it gives me error number 24776 "cannot start a new transaction". Without setting isolation level, the transaction would go smoothly. Note that this is the only transaction I have in my small test program. You can test it with the example given in oracle documentation.

    Hi,
    I'm using JDBC with oracle DB 8.1.6. When I get the physical connection and set transaction isolation level to TRANSACTION_SERIALIZABLE then issue start() on the XAResource instance it gives me error number 24776 "cannot start a new transaction". Without setting isolation level, the transaction would go smoothly. Note that this is the only transaction I have in my small test program. You can test it with the example given in oracle documentation. i don't think you are allowed to set transaction isolation level to Serializable for XA

  • Setting isolation level fails

    Hi,
    Im using Kodo 3.0.0 on Oracle 8.1.7.
    I tried to define the isolation level in the kodo.properties:
    e.g.: kodo.jdbc.TransactionIsolation: serializable
    Unfortunately Oracle throws an exception which says, that "set
    transaction" has to be the first statement called within a transaction. I
    get this exception on almost every db access.
    java.sql.SQLException: ORA-01453: SET TRANSACTION muss erste Anweisung der
    Transaktion sein
    at
    kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:42)
    at
    kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:24)
    at
    kodo.jdbc.schema.LazySchemaFactory.findTable(LazySchemaFactory.java:1
    50)
    at
    kodo.jdbc.meta.VerticalClassMapping.fromMappingInfo(VerticalClassMapp
    ing.java:135)
    at
    kodo.jdbc.meta.RuntimeMappingProvider.getMapping(RuntimeMappingProvid
    er.java:56)
    at
    kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository
    java:342)
    at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:29
    7)
    at
    kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository
    java:325)
    at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:29
    7)
    at
    kodo.jdbc.meta.MappingRepository.getMappings(MappingRepository.java:2
    72)
    at
    kodo.jdbc.meta.MappingRepository.getMetaDatas(MappingRepository.java:
    256)
    at kodo.query.AbstractQuery.internalCompile(AbstractQuery.java:538)
    at kodo.query.AbstractQuery.compile(AbstractQuery.java:502)
    at kodo.datacache.CacheAwareQuery.compile(CacheAwareQuery.java:265)
    -- Wolfgang

    Marc,
    Here you go...
    kodo.util.FatalDataStoreException: ORA-01453: SET TRANSACTION must be
    first statement of transaction
         at
    kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:897)
         at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
         at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:566)
         at
    edu.sjsu.recon.contribution.action.jdo.v10.kodo.v32.oracle.v101.simple.concurrency.AbstractConcurrentAction.initTestModel(AbstractConcurrentAction.java:290)
         at
    edu.sjsu.recon.contribution.action.jdo.v10.kodo.v32.oracle.v101.simple.concurrency.AbstractConcurrentAction$InitRunnable.run(AbstractConcurrentAction.java:212)
         at
    edu.sjsu.recon.util.ConcurrencyUtilities.executeSynchronized(ConcurrencyUtilities.java:20)
         at
    edu.sjsu.recon.contribution.action.jdo.v10.kodo.v32.oracle.v101.simple.concurrency.AbstractConcurrentAction.setup(AbstractConcurrentAction.java:75)
         at
    edu.sjsu.recon.execution.ServerExecutor.beforeExecute(ServerExecutor.java:27)
         at
    edu.sjsu.recon.execution.AbstractExecutor.execute(AbstractExecutor.java:43)
         at
    edu.sjsu.recon.execution.DefaultExecutionCoordinator.executeAction(DefaultExecutionCoordinator.java:25)
         at
    edu.sjsu.recon.server.handler.ExecutionRequestHandler.handleRequest(ExecutionRequestHandler.java:63)
         at edu.sjsu.recon.server.RequestProcessor.run(RequestProcessor.java:90)
    NestedThrowablesStackTrace:
    kodo.util.DataStoreException: ORA-01453: SET TRANSACTION must be first
    statement of transaction
         at
    kodo.jdbc.sql.DBDictionary.newDataStoreException(DBDictionary.java:3004)
         at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:77)
         at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:63)
         at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:43)
         at kodo.jdbc.runtime.JDBCStoreManager.connect(JDBCStoreManager.java:871)
         at
    kodo.jdbc.runtime.JDBCStoreManager.retainConnection(JDBCStoreManager.java:189)
         at kodo.jdbc.runtime.JDBCStoreManager.begin(JDBCStoreManager.java:114)
         at
    kodo.runtime.DelegatingStoreManager.begin(DelegatingStoreManager.java:95)
         at
    kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl.java:1004)
         at
    kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:885)
         at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
         at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:566)
         at
    edu.sjsu.recon.contribution.action.jdo.v10.kodo.v32.oracle.v101.simple.concurrency.AbstractConcurrentAction.initTestModel(AbstractConcurrentAction.java:290)
         at
    edu.sjsu.recon.contribution.action.jdo.v10.kodo.v32.oracle.v101.simple.concurrency.AbstractConcurrentAction$InitRunnable.run(AbstractConcurrentAction.java:212)
         at
    edu.sjsu.recon.util.ConcurrencyUtilities.executeSynchronized(ConcurrencyUtilities.java:20)
         at
    edu.sjsu.recon.contribution.action.jdo.v10.kodo.v32.oracle.v101.simple.concurrency.AbstractConcurrentAction.setup(AbstractConcurrentAction.java:75)
         at
    edu.sjsu.recon.execution.ServerExecutor.beforeExecute(ServerExecutor.java:27)
         at
    edu.sjsu.recon.execution.AbstractExecutor.execute(AbstractExecutor.java:43)
         at
    edu.sjsu.recon.execution.DefaultExecutionCoordinator.executeAction(DefaultExecutionCoordinator.java:25)
         at
    edu.sjsu.recon.server.handler.ExecutionRequestHandler.handleRequest(ExecutionRequestHandler.java:63)
         at edu.sjsu.recon.server.RequestProcessor.run(RequestProcessor.java:90)
    NestedThrowablesStackTrace:
    java.sql.SQLException: ORA-01453: SET TRANSACTION must be first statement
    of transaction
         at
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
         at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:112)
         at oracle.jdbc.driver.T4CStatement.execute_for_rows(T4CStatement.java:474)
         at
    oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1028)
         at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1516)
         at
    oracle.jdbc.driver.PhysicalConnection.setTransactionIsolation(PhysicalConnection.java:1412)
         at
    com.solarmetric.jdbc.DelegatingConnection.setTransactionIsolation(DelegatingConnection.java:266)
         at
    com.solarmetric.jdbc.DelegatingConnection.setTransactionIsolation(DelegatingConnection.java:266)
         at
    com.solarmetric.jdbc.DelegatingConnection.setTransactionIsolation(DelegatingConnection.java:266)
         at
    com.solarmetric.jdbc.DelegatingConnection.setTransactionIsolation(DelegatingConnection.java:266)
         at
    com.solarmetric.jdbc.ConfiguringConnectionDecorator.decorate(ConfiguringConnectionDecorator.java:93)
         at
    com.solarmetric.jdbc.DecoratingDataSource.decorate(DecoratingDataSource.java:90)
         at
    com.solarmetric.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:82)
         at
    com.solarmetric.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:131)
         at
    kodo.jdbc.schema.DataSourceFactory$DefaultsDataSource.getConnection(DataSourceFactory.java:305)
         at
    kodo.jdbc.runtime.JDBCStoreManager.connectInternal(JDBCStoreManager.java:887)
         at kodo.jdbc.runtime.JDBCStoreManager.connect(JDBCStoreManager.java:865)
         at
    kodo.jdbc.runtime.JDBCStoreManager.retainConnection(JDBCStoreManager.java:189)
         at kodo.jdbc.runtime.JDBCStoreManager.begin(JDBCStoreManager.java:114)
         at
    kodo.runtime.DelegatingStoreManager.begin(DelegatingStoreManager.java:95)
         at
    kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl.java:1004)
         at
    kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:885)
         at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
         at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:566)
         at
    edu.sjsu.recon.contribution.action.jdo.v10.kodo.v32.oracle.v101.simple.concurrency.AbstractConcurrentAction.initTestModel(AbstractConcurrentAction.java:290)
         at
    edu.sjsu.recon.contribution.action.jdo.v10.kodo.v32.oracle.v101.simple.concurrency.AbstractConcurrentAction$InitRunnable.run(AbstractConcurrentAction.java:212)
         at
    edu.sjsu.recon.util.ConcurrencyUtilities.executeSynchronized(ConcurrencyUtilities.java:20)
         at
    edu.sjsu.recon.contribution.action.jdo.v10.kodo.v32.oracle.v101.simple.concurrency.AbstractConcurrentAction.setup(AbstractConcurrentAction.java:75)
         at
    edu.sjsu.recon.execution.ServerExecutor.beforeExecute(ServerExecutor.java:27)
         at
    edu.sjsu.recon.execution.AbstractExecutor.execute(AbstractExecutor.java:43)
         at
    edu.sjsu.recon.execution.DefaultExecutionCoordinator.executeAction(DefaultExecutionCoordinator.java:25)
         at
    edu.sjsu.recon.server.handler.ExecutionRequestHandler.handleRequest(ExecutionRequestHandler.java:63)
         at edu.sjsu.recon.server.RequestProcessor.run(RequestProcessor.java:90)
    Marc Prud'hommeaux wrote:
    Cleo-
    Can you post the complete stack (including all the nested stack traces)?
    In article <[email protected]>, Cleo wrote:
    Marc,
    Here is the stack:
    ORA-01453: SET TRANSACTION must be first statement of transaction
    kodo.util.FatalDataStoreException
         at
    kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:897)
         at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
         at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:566)
    This is the code being executed:
    Transaction initTransaction = initPersistenceManager.currentTransaction();
    initTransaction.begin();
    initPersistenceManager.makePersistentAll(model);
    initTransaction.commit(); //EXCEPTION HERE
    initPersistenceManager.close();
    thx
    Marc Prud'hommeaux wrote:
    Cleo-
    Can you post the complete stack trace from the exception? I expect it is
    different from the one posted previously (which was with a much earlier
    version of Kodo).
    In article <[email protected]>, Cleo wrote:
    Has anybody figured out how to solve this?
    I am having the same problem with:
    KODO 3.2
    Oracle JDBC Dirver 10.1.0.3
    thx
    PS: (I am on a deadline for the end of this week)
    Stephen Kim wrote:
    First I would suggest using Kodo 3.0.1. Second I would suggest trying
    to use 9.0.1 drivers which work very well with 8.1.7.
    Wolfgang Hutya wrote:
    Hi,
    Im using Kodo 3.0.0 on Oracle 8.1.7.
    I tried to define the isolation level in the kodo.properties:
    e.g.: kodo.jdbc.TransactionIsolation: serializable
    Unfortunately Oracle throws an exception which says, that "set
    transaction" has to be the first statement called within a
    transaction.
    I
    get this exception on almost every db access.
    java.sql.SQLException: ORA-01453: SET TRANSACTION muss erste
    Anweisung
    der
    Transaktion sein
    at
    kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:42)
    at
    kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:24)
    at
    kodo.jdbc.schema.LazySchemaFactory.findTable(LazySchemaFactory.java:1
    50)
    at
    kodo.jdbc.meta.VerticalClassMapping.fromMappingInfo(VerticalClassMapp
    ing.java:135)
    at
    kodo.jdbc.meta.RuntimeMappingProvider.getMapping(RuntimeMappingProvid
    er.java:56)
    at
    kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository
    java:342)
    at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:29
    7)
    at
    kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository
    java:325)
    at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:29
    7)
    at
    kodo.jdbc.meta.MappingRepository.getMappings(MappingRepository.java:2
    72)
    at
    kodo.jdbc.meta.MappingRepository.getMetaDatas(MappingRepository.java:
    256)
    atkodo.query.AbstractQuery.internalCompile(AbstractQuery.java:538)
    at kodo.query.AbstractQuery.compile(AbstractQuery.java:502)
    atkodo.datacache.CacheAwareQuery.compile(CacheAwareQuery.java:265)
    -- Wolfgang
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com
    Marc Prud'hommeaux
    SolarMetric Inc.
    Marc Prud'hommeaux
    SolarMetric Inc.

  • Setting transaction isolation level in a session bean

    Hi all!
    In a stateless session bean (EJB3) with container managed transactions I need to set the transaction isolation level to SERIALIZABLE.
    The idea is to prevent lost update on database when multiple accesses occur concurrently.
    Thanks in advance for your patience,
    Tommaso

    Hi all!
    In a stateless session bean (EJB3) with container managed transactions I need to set the transaction isolation level to SERIALIZABLE.
    The idea is to prevent lost update on database when multiple accesses occur concurrently.
    Thanks in advance for your patience,
    Tommaso

Maybe you are looking for

  • No video playback on Windows 8 Pro

    I'm trying to play vídeos on my Windows 8 and all I can see is a black screen and I can only hear the sound. This happens everywhere. Youtube, video apps, media player. I can't understand why. I've installed already the K-Lite Codec pack and I've upg

  • Reading a Blob (CSV file) and displaying the contents

    Hello Experts, I'm currently working on a system that allows the users to upload an Excel spreadsheet (.xls) in the system. The upload page is a PL/SQL cartridge. Then I've written a Java servlet (using Oracle Clean Content) to convert the XLS into a

  • Full export - BU and workbooks

    Hi! How can I do a full export of the EUL which includes the business areas as well as the workbooks? We are migrating to a new box and I created the EUL with Disc Admin on the new box. But an export through the wizard (on the old box) only takes the

  • WRT54G v6, suddenly slow response

    I have my WRT54G v6 for over an year now. My computer is wired to it, and so is router wired to the modem, so we're not talking about wireless problems here. The problem started when all pages started to load once in three tries or so. I blamed my IS

  • Vista freezing after KB951847

    Has anyone been having any issues with their Thinkpads freezing after installing "Microsoft .NET Framework 3.5 Service Pack 1 and .Net Framework 3.5 Family Update (KB951847)"?  I have several Thinkpads, mostly R61s and some T61s, that will lock up ev