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

Similar Messages

  • 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

  • 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

  • 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 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

  • 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
              >
              >
              

  • 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.
              > >>
              > >
              > >
              >
              

  • 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]

  • SQLServer Isolation Level Problem?

    Since the MSSQLServer driver has trouble when returning explicit cursors, and since the complexitites of one of our procedures requires the use of cursors we have been forced to split a DBMS procedure into two. Ie. we have one method that updates the database and one that retrieves the "return value", ie. a setXXX and then a getXXX method.
    The problem is that we sometimes get an empty resultset from the getXXX method. Note that this behaviour is not due to the server code as this error is not present if run directly on the SQLServer (ie, not through the JDBC driver). Now testing to and fro suggests that the error is caused by some sort of parallell behaviour or isolation level trouble in the driver, but what exactly? The thing is, if I insert a pause of a few milliseconds between the two calls it works correctly (of course I cannot place a "random" pause there in production code since the pause will probably vary depending on the underlying hardware). I have tried setting to different TransactionIsolation levels, but get the same result all the time. There is only one linear execution of the code as shown below (no multithreading in the java application).
    What I'm wondering is: are there any "switches" to turn in relation to waiting for a a stored procedure to finish execution before the next is called? I would expect this to be implicit, but perhaps the SQLServer runs them in parallell and therefore the second method is called before the first is finished, but then, shouldn't the TransactionIsolationLevel of Serializable hinder this? I would appreciate any help on this one, sample code below, the problem being that wereas the while loop should always print the line it sometimes doesn't since the result is empty (not null, empty). It isn't the parameter to the execute_task either, we get the "missing result" problem with different paramaters that all always work when run directly on the SQLServer (via SQL Query Analyzer).
    //Execute the update to the server
    CallableStatement execute_task = connection.prepareCall("{call setXXX(?)}");
    execute_task.setInt(1, 1);
    execute_task.execute();
    //Retrieve the task execution results:
    CallableStatement show_execute_task = connection.prepareCall("{call getXXX}");
    show_execute_task.execute();
    ResultSet show_execute_resultset = show_execute_task.getResultSet();
    while(show_execute_resultset.next()){
    System.out.println("Result received");
    }

    Since the MSSQLServer driver has trouble when
    returning explicit cursors, and since the
    complexitites of one of our procedures requires the
    use of cursors we have been forced to split a DBMS
    procedure into two. Ie. we have one method that
    updates the database and one that retrieves the
    "return value", ie. a setXXX and then a getXXX method.
    The problem is that we sometimes get an empty
    resultset from the getXXX method. Note that this
    behaviour is not due to the server code as this error
    is not present if run directly on the SQLServer (ie,
    not through the JDBC driver). Now testing to and fro
    suggests that the error is caused by some sort of
    parallell behaviour or isolation level trouble in the
    driver, but what exactly? The thing is, if I insert a
    pause of a few milliseconds between the two calls it
    works correctly (of course I cannot place a "random"
    pause there in production code since the pause will
    probably vary depending on the underlying hardware).
    I have tried setting to different
    TransactionIsolation levels, but get the same result
    all the time. There is only one linear execution of
    the code as shown below (no multithreading in the
    java application).
    What I'm wondering is: are there any "switches" to
    turn in relation to waiting for a a stored procedure
    to finish execution before the next is called? I would
    expect this to be implicit, but perhaps the SQLServer
    runs them in parallell and therefore the second methodthis is what i would expect. parallel execution i mean... othewise you might as well use Access...
    is called before the first is finished, but then,
    shouldn't the TransactionIsolationLevel of
    Serializable hinder this? I would appreciate any helpi'm not sure...
    t be perfectly honest while i understand the different transaction levels on their face level as described in java.sql.Connection I am not entirely sure WHAT the expected behaviour actually is for each level.
    not to get too OT here but for example TRANSACTION_REPEATABLE_READ
    if the first transaction reads row 1 from tableA
    then a second transaction changes row 1 in table A and commits the changes
    the first transaction reads row 1 from table A again... what the heck is supposed to happen. i think it is supposed to read the same values as the first pass even though commited changes have been made but i'm not entirely sure.
    on this one, sample code below, the problem being that
    wereas the while loop should always print the line it
    sometimes doesn't since the result is empty (not null,
    empty). It isn't the parameter to the execute_task
    either, we get the "missing result" problem with
    different paramaters that all always work when run
    directly on the SQLServer (via SQL Query Analyzer).
    //Execute the update to the server
    CallableStatement execute_task =
    connection.prepareCall("{call setXXX(?)}");
    execute_task.setInt(1, 1);
    execute_task.execute();
    //Retrieve the task execution results:
    CallableStatement show_execute_task =
    connection.prepareCall("{call getXXX}");
    show_execute_task.execute();
    ResultSet show_execute_resultset =
    show_execute_task.getResultSet();
    while(show_execute_resultset.next()){
    System.out.println("Result received");
    }i don't really follow your code too well here but here is what i would suggest...
    fetch whatever the first procedure returns FIRST.
    this should force your app to wait on this before you execute the second one.
    does that make sense? it seems simple to me but maybe i'm missing something.

  • 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

  • Isolation Level problems with DDConverter , wl4.51 (EJB spec 1.0) to wl5.1 (EJB spec 1.1)

    Hi ,
    I was using the DDConvertor supplied with WL51 to convert my old
    DeploymentDescriptor.txt to the new XML format.
    I have noticed that the Isolation Level did not pass to the new format.
    My entity bean is not container managed and the Isolation level is
    READ_COMMITED .
    No weblogic-cmp-rdbms-jar.xml File was generated.
    Attached are the files.
    Could you please tell me where can I specify the Isolation Level if I have
    no rdbms file ?
    thanks
    Amit Sivan
    [DeploymentDescriptor.txt]
    [weblogic-ejb-jar.xml]

    weblogic-ejb-jar.xml
    amit sivan wrote:
    Hi ,
    I was using the DDConvertor supplied with WL51 to convert my old
    DeploymentDescriptor.txt to the new XML format.
    I have noticed that the Isolation Level did not pass to the new format.
    My entity bean is not container managed and the Isolation level is
    READ_COMMITED .
    No weblogic-cmp-rdbms-jar.xml File was generated.
    Attached are the files.
    Could you please tell me where can I specify the Isolation Level if I have
    no rdbms file ?
    thanks
    Amit Sivan
    ; Copyright (c) 1998-1999 by BEA WebXpress. All Rights Reserved.
    (EntityDescriptor
    beanHomeName pay2card.OnlineHomeEntity
    enterpriseBeanClassName pay2card.beans.online.entity.OnlineEntityBean
    homeInterfaceClassName pay2card.beans.online.entity.OnlineEntityHome
    remoteInterfaceClassName pay2card.beans.online.entity.OnlineEntity
    isReentrant false
    (accessControlEntries
    ; DEFAULT [admin manager]
    ); end accessControlEntries
    (controlDescriptors
    (DEFAULT
    isolationLevel TRANSACTION_READ_COMMITTED
    transactionAttribute TX_REQUIRED
    runAsMode CLIENT_IDENTITY
    ; runAsIdentity admin
    ); end DEFAULT
    ); end controlDescriptors
    (environmentProperties
    ; homeClassName
    ; ejbObjectClassName
    maxBeansInFreePool 20
    maxBeansInCache 1000
    idleTimeoutSeconds 60
    ; isModifiedMethodName isModified
    ); end environmentProperties
    ; Entity EJBean-specific properties:
    primaryKeyClassName pay2card.beans.online.entity.OnlinePK
    ; end entity EJBean-specific properties.
    ); end EntityDescriptor
    <?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>pay2card.OnlineHomeEntity</ejb-name>
    <caching-descriptor>
    <max-beans-in-free-pool>20</max-beans-in-free-pool>
    <max-beans-in-cache>1000</max-beans-in-cache>
    <idle-timeout-seconds>60</idle-timeout-seconds>
    </caching-descriptor>
    <persistence-descriptor>
    <delay-updates-until-end-of-tx>false</delay-updates-until-end-of-tx>
    </persistence-descriptor>
    <jndi-name>pay2card.OnlineHomeEntity</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>

Maybe you are looking for

  • Online number

    I purchased an online number to replace my normal landline, and it is not working after a day, I was not asked to verify it, the system said it would be up and running immediatly, I ring the number from a land line, it rings once then goes into an en

  • Issue about BI JAVA SDK-SOAP request failed with return message 2147483653

    Dear Experts, I'm trying to use BI JAVA SDK to connect BW by using XMLA connector. But there's an error messaet said : SOAP request failed with return message 2147483653 ( Invalid MDX command with INCLUDING) I'm really new to this JAVA SDK, and after

  • BAPI_PO_CREATE1 - In case of account assignment, please enter acc. assignme

    Hello! While using bapi_po_create1 and making it account assignment in services case i get an error E 06 436 In case of account assignment, please enter acc. assignment data for item Thanks!

  • Files size limit for vimeo upload

    Hi, There is a warning sign that says ''publishing movies bigger than 5 GB may fail''. Why is that ? I have a vimeo pro account (I can dowload up to 20 GB per week. Does vimeo have file size limits for uploads ?

  • Quicktime X: Bookmark progress in a video?

    I watch lots of videos but like to stop halfway through and come back to them later. I'd like a way to mark the progress I've made in the video, i.e. leave a bookmark at the time that I stopped watching. That way I can reopen the file and start where