Apply slowdown on transaction with ROLLBACK TO UBA LCRs

I have streams configuration consisting of several captures and propagations on four servers an one destination db with several applys.
Each capture has its own propagation and its own apply on destination server.
All works almost fine.
But sometimes one apply process becomes slowly.
As each stream has heartbeat table with 30 seconds insert/delete sequence, normal delay between message capture time and apply time 1-3 minutes as max.
But sometimes it became 3-4 hours.
I started to search the root of problem and found following:
When problem exist, apply reader process in latch shared pool contention. The OS process of apply reader is at 100% CPU usage.
DBA_APPLY_SPILL_TXN showing one transaction for that apply.
I use following script to see contents of that transaction:
DECLARE
  TYPENM   VARCHAR2(61);
  DDLLCR   SYS.LCR$_DDL_RECORD;
  PROCLCR  SYS.LCR$_PROCEDURE_RECORD;
  ROWLCR   SYS.LCR$_ROW_RECORD;
  RES      NUMBER;
  NEWLIST  SYS.LCR$_ROW_LIST;
  OLDLIST  SYS.LCR$_ROW_LIST;
  DDL_TEXT CLOB;
  EXT_ATTR ANYDATA;
  I        NUMBER;
BEGIN
  I := 0;
  SELECT COUNT(*)
    INTO I
    FROM aq$qta_strm1 T
   WHERE T.QUEUE = 'QA_STRM1'
   ORDER BY T.MSG_ID ASC;
  DBMS_OUTPUT.PUT_LINE('### CNT: ' || I);
  I := 0;
  FOR C IN (SELECT *
              FROM aq$qta_strm1 T
             WHERE T.QUEUE = 'QA_STRM1'
             ORDER BY T.MSG_ID ASC) LOOP
    IF (C.USER_DATA IS NOT NULL) THEN
      TYPENM := C.USER_DATA.GETTYPENAME();
      IF (TYPENM = 'SYS.LCR$_ROW_RECORD') THEN
        RES := C.USER_DATA.GETOBJECT(ROWLCR);
          DBMS_OUTPUT.PUT_LINE('MSG_ID: ' || C.MSG_ID);
          PRINT_LCR(C.USER_DATA);
          I := I + 1;
      END IF;
    END IF;
  END LOOP;
  DBMS_OUTPUT.PUT_LINE('### NN: ' || I);
END;And it gives me following:
<tt>
### CNT: 3150
MSG_ID: 03690459
source database: SOURCEDB.MYDOMAIN.COM
owner:
object:
is tag null: Y
command_type: ROLLBACK TO UBA
transaction_id: 9.46.1687138
MSG_ID: 03690460
source database: SOURCEDB.MYDOMAIN.COM
owner:
object:
is tag null: Y
command_type: ROLLBACK TO UBA
transaction_id: 9.46.1687138
MSG_ID: 03690461
source database: SOURCEDB.MYDOMAIN.COM
owner:
object:
is tag null: Y
command_type: ROLLBACK TO UBA
transaction_id: 9.46.1687138
MSG_ID: 03690462
source database: SOURCEDB.MYDOMAIN.COM
owner:
object:
is tag null: Y
command_type: ROLLBACK TO UBA
transaction_id: 9.46.1687138
+... and so on ...+
</tt>
I didn't find any description about lcr type ROLLBACK TO UBA.
Whole transaction consists of messages of such type.
So I just put transaction to IGNORE_TRANSACTION parameter of apply and problem disappeared for now.
But I believe it will come back again.
So, who can explain me what lcr type ROLLBACK TO UBA means? where it come from? and how to avoid this problem again?
PS:
Source database 10.2.0.4 64bit-linux
Dest. db 11.2.0.3 64bit-linux
Edited by: user5464827 on 02.04.2013 0:05

Hi Onno,
If you have enabled "auto commit", then you cannot call methods like "commit()" or "rollback()". After you have executed your INSERT, a "commit" automatically happens -- if the INSERT succeeds -- or a "rollback" automatically happens (if the INSERT fails). You are calling the "commit()" method when there is no open transaction -- which is wrong and therefore you get an error (SQLException).
Same problem occurs when you catch the error caused by your "commit" and try to "rollback" -- you cannot "rollback" when there is no open transaction.
As I see it, you have two choices:
1. disable auto commit, or
2. remove the calls to "commit()" and "rollback()"
Hope this helps you.
Good Luck,
Avi.

Similar Messages

  • Invoice and Payment in transaction with rollback

    Hi,
    I want to create a payment and an invoice in one scenario step as a synchronous WS call.
    If I create the payment first, then the invoice, how can I roll back the payment if the invoice fails?
    Thanks,
    Jon

    Hi Gordon,
    I mean that if I successfully add the invoice, but for whatever reason the payment fails to add.
    If I was coding this in c# I would start a company transaction, add the invoice, add the payment and then commit the transaction.  If there was a problem adding the payment I would expect the transaction to roll back.
    Is there a way I can wrap the two document creations into a company transaction with B1if?
    Regards,
    Jon

  • Problem with rollback in EJB and CMT

    Hello,
    I faced a problem in my application that I really do not understand (but I really would like to). How can I trigger a rollback of a transaction that is container-managed (CMT)? I know that any system exceptions are supposed to be handled by the container automatically and will cause a transaction rollback when they are thrown from an enterprise bean method. My Problem now is that I'm unable to make this work in my application.
    Consider a situation like this:
    The ManageEntityBean holds a simple save() method that creates an instance of EntityA and another of EntityB. Both instances store an arbitrary number (here 10). After this, the entityManger (injected from the container) is asked to make these instances persistent. EntityB is mapped with a "unique" constraint, so any attempt to store the same number twice will cause an SQL Exception.
    First time when the save() method is invoked, the instances aEntity and bEntity are made permanent in the database. Second time when the save() method is invoked, the database throws an exception because bEntity is violating the unique constraint. What I would expect now is a complete rollback of the whole transaction. Instead, only bEntity has not been made permanent, but aEntity has.
    What's wrong with this code?
    @Stateless
    public class ManageEntityBean implements ManageEntity {
         @PersistenceContext
         private EntityManager entityManager;
         @TransactionAttribute(TransactionAttributeType.REQUIRED)
         public void save() {
              try {
                   EntityA aEntity = new EntityA(10);
                   EntityB bEntity = new EntityB(10);
                    entityManager.persist(aEntity);
                    entityManager.persist(bEntity);
              } catch (Exception e) {
                   throw new EJBException(e);
    @Entity
    public class EntityA implements java.io.Serializable {
         @Id
         @GeneratedValue
         private long     id;
            @Column(name="NUMBER")
            private int   number;
         public EntityA() {}
         public EntityA(int number) {
              this.number = number;
    @Entity
    public class EntityB implements java.io.Serializable {
         @Id
         @GeneratedValue
         private long     id;
         @Column(name = "NUMBER", unique = true)
         private int          number;
         public EntityB() {}
         public EntityB(int number) {
              this.number = number;
    }I found two related topics in this forum but still I didn't find the solution yet.
    [Enterprise JavaBeans - CMT and JDBC|http://forums.sun.com/thread.jspa?forumID=13&threadID=525651]
    and
    [ Forums - A CMT Session Bean Does Not Maintain the Transaction Correctly| http://forums.sun.com/thread.jspa?forumID=13&threadID=161512]
    Maybe anyone can give me a hint. Help is very much appreciated
    Christoph

    Thank you for your input!
    The save() method is simply invoked from the test applications main() method:
    public class Test {
         public static void main(String[] args) {
              JndiUtil<ManageEntity> jndiUtil = new JndiUtil<ManageEntity>();
              ManageEntity handler = jndiUtil.lookupBeanContext("ManageEntityBean", ManageEntity.class);
              handler.save();
    }Btw. I use Hibernate as persistence provider and JBoss 4.2.2.GA as application server.
    For clarity I attach some lines of the debug logging that is produced when the test application is getting started for the second time:
    ### open Session
    17:44:00,555 DEBUG *[SessionImpl] opened session at timestamp: 5007498610909184*
    17:44:00,555 DEBUG [AbstractEntityManagerImpl] Looking for a JTA transaction to join
    17:44:00,555 DEBUG [JDBCContext] successfully registered Synchronization
    17:44:00,555 DEBUG [AbstractEntityManagerImpl] Looking for a JTA transaction to join
    17:44:00,555 DEBUG [AbstractEntityManagerImpl] Transaction already joined
    ### invoke em.persist(aEntity)
    17:44:00,555 DEBUG [AbstractSaveEventListener] executing identity-insert immediately
    17:44:00,555 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
    17:44:00,555 DEBUG *[ConnectionManager] opening JDBC connection*
    17:44:00,555 DEBUG [SQL]
    /* insert de.zippus.domain.EntityA
    17:44:00,556 INFO [STDOUT] Hibernate:
    /* insert de.zippus.domain.EntityA
    17:44:00,558 DEBUG [IdentifierGeneratorFactory] Natively generated identity: 2
    17:44:00,559 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
    17:44:00,559 DEBUG [ConnectionManager] aggressively releasing JDBC connection
    17:44:00,559 DEBUG [ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: >0)]
    ### invoke em.persist(bEntity)
    17:44:00,559 DEBUG [AbstractSaveEventListener] executing identity-insert immediately
    17:44:00,559 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
    17:44:00,559 DEBUG [ConnectionManager] opening JDBC connection
    17:44:00,559 DEBUG [SQL]
    /* insert de.zippus.domain.EntityB
    17:44:00,560 INFO [STDOUT] Hibernate:
    /* insert de.zippus.domain.EntityB
    17:44:00,561 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
    17:44:00,561 DEBUG [ConnectionManager] aggressively releasing JDBC connection
    17:44:00,561 DEBUG [ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: >0)]
    17:44:00,561 DEBUG [JDBCExceptionReporter] could not insert: [de.zippus.domain.EntityB] [* insert de.zippus.domain.EntityB */ insert into >ENTITY_B (NUMBER) values (?)]
    com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '10' for key 2
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
    17:44:00,563 WARN [JDBCExceptionReporter] SQL Error: 1062, SQLState: 23000
    17:44:00,563 ERROR [JDBCExceptionReporter] Duplicate entry '10' for key 2
    17:44:00,563 DEBUG [AbstractEntityManagerImpl] mark transaction for rollback
    17:44:00,563 ERROR [ManageEntityBean] Caught exception: javax.persistence.EntityExistsException: >org.hibernate.exception.ConstraintViolationException: could not insert: [de.zippus.domain.EntityB]
    17:44:00,563 ERROR [ManageEntityBean] Exception Cause: org.hibernate.exception.ConstraintViolationException: could not insert: >[de.zippus.domain.EntityB]
    17:44:00,564 DEBUG *[ManagedEntityManagerFactory] ************** closing entity managersession *************** Up to now I'm not that experienced in reading and understanding this kind of logging, but what I can see is, that there is a transaction that spans the whole unit of work and that this transaction is marked for rollback. I think that's quite a good thing, isn't it?
    But what really puzzles me here is, that both calls of em.persist() result in an opening of a jdbc connection and an immidiate execution of a database insert. Tell me if I'm wrong, but is this really the right place to happen?
    For what reason soever hibernate thinks it has to make these instances permanent, no matter if there is already a session that is taking care of this. If so, I might deal with a wrong hibernate configuration, I checked, but I can't find anything..
    What do you think?
    Thanks in advance!
    Christoph

  • You cannot reconcile a/p invoice transaction with A/P Down Payment request manually

    Dear Experts,
    One of my client has facing this problem while doing Reconciliation then he is getting the following error.
    "you cannot reconcile a/p invoice transaction with A/P Down Payment request manually"
    then we found a solution in SAP Forums and applied the same in Test Company Environment, then its working good and also attaching the scenario with screen shot.
    Please have a look into the attachment then tell us. Is it a good practice to proceed or is there any solution as simple as this.
    One more thing is my client has having more 20000 records to do reconciliation and he is looking for any alternative solution.
    So please tell us a Better solution.
    We are awaiting for your prompt response.....

    Hi,
    Please check SAP note:
    1340606 - Paid Down Payment Request cannot be reconciled
    internally.
    Thanks & Regards,
    Nagarajan

  • How to execute a transaction with a different user from the logged user?

    Hello Experts!
    I'm trying to find out a solution about this scenario: our users need to release a Purchase Order (ME28) and/or a Service Entry Sheet (ML85) in SAP from a WEB based application through TIBCO, but the requirement is to execute this operation with the same SAP User name of the user (with his authorization) and not with the TIBCO user that is logged to SAP.
    Is there someone that could suggest me a real time solution and how to develop it? I really appreciate your contribute and I'm at your disposal for any further information.
    Thank you very much!
    Alessandro

    Hi Rob!
    Thank you for your help, but I can't apply this solution, because we need to execute the transaction with a specific user name and not a generic user, besides our user have different authorization, for example the user Mr. Rossi can release only his Purchase Order but not the PO of another user Mr. Bianchi. Moreover we need to see the PO released/modified from a specif user name. So this is our constraint.
    Bye Ale.

  • Problem with rollback

    Hello,
    I have this query
    DECLARE @TransactionName varchar(20) = 'inlinefunctionTransaction';
    begin tran @TransactionName
     select * from jsp('S1','P1');
    ROLLBACK TRAN @TransactionName;
    go
    but when executing it I get a message
    Cannot roll back inlinefunctionTransaction. No transaction or savepoint of that name was found. 
    Can anybody explin me please what's going wrong?
    Thanks

    Thanks, but I tried with
    DECLARE
    @TransactionName
    varchar(40)='infTransaction';
    but again happened, so the varchar od 20 was not the problem.I have begin tran for several dierent procedures. All of them start with
    DECLARE
    @TransactionName
    varchar(40)='infTransaction';
    begin
    tran
    @TransactionName
    but only the last function ends with
    ROLLBACK
    TRAN
    @TransactionName;
    and all the procedures end with go, which I don't know whether is ok.
    Thanks

  • Is it possible to get an event, if user end transaction with /n?

    Hello,
    i have written an own control component(combination from enjoy controls(Toolbar, Tree and Splitter) in ABAP. If the User end the transaction with the gui status BACK END or CANCEL, I got a PAI and can say save_layout( ) set screen 0 leave screen, that next time the control has the same layout. If the user leaves the transaction with /n, I get no PAI to save the layout. If there are any event that I can catch to save the layout of my control. I find the class cl_system_transaction_state with event transaction_finished, but this event is only raised by commit work or rollback work.
    Thanks & Regards

    Hello,
    There is no event triggered on a "/n".
    Users should know that "/n" leave the transaction brutaly without any confirmation
    Sorry
    Regards
    JM

  • Set Transaction Use Rollback segment

    Hi everybody. Does It make sense issue a "set transaction use rollback" for a single query that do not update, insert or delete. The trouble is that I get e "SnapShot too Old" for a query that just do a query.
    Thanks!

    No, If you are not making any modifications then you do not generate rollback (or even a transaction to my knowledge). The SNAPSHOT TOO OLD is because a different session has run through the rollback for the read consistent view you need (either because someone made changes to a table you are reading or from delayed block cleanout). Delayed block cleanout is a pretty complicated scenario so I'll leave it to the Oracle documentation to explain that. Just be aware that even if nobody has made changes to the table since you started your query you can still get SNAPSHOT TOO OLD. Thankfully, 9i helps elleviate this somewhat with the introduction of UNDO TABLESPACES.
    Richard

  • How to call a transaction with a variant

    Hi all
    I created a bdc program after updating it should call another transaction with predefined variant that that transaction program is of type module pool.
    can anyone tell me the syntax how to call a transaction with a variant.

    Hi
    goto Tcode SHD0
    enter the Tcode for which Tran Variant has to be created(dialog Tcode)
    enter Trans variant to be created
    press create button
    it will go through all the screens of that Tcode and save
    and modify the fields as per requirement
    we can create Transaction Variants Using SHD0 Transaction.
    Transaction Variants and Screen Variants
    Transaction variants can simplify transaction runs as they allow you to:
    Preassign values to fields
    Hide and change the 'ready for input' status of fields
    Hide and change table control column attributes
    Hide menu functions
    Hide entire screens
    In particular, hiding fields in connection with screen compression, and hiding screens, can result in greater clarity and simplicity.
    Transaction variants are made up of a sequence of screen variants. The field values and field attributes for the individual screens found in transaction variants are stored in screen variants. Each of these variants is assigned to a specific transaction, can, however, also contain values for screens in other transactions if this is required by transaction flow. The transaction that the variant is assigned to serves as initial transaction when the variant is called.
    There are both client-specific and cross-client transaction variants. All screen variants are cross-client, but may be assigned to a client-specific transaction variant.
    A namespace exists for cross-client transaction variants and screen variants and both are automatically attached to the Transport Organizer. Client-specific transaction variants must be transported manually.
    In principle, transaction and screen variants can be created for all dialog and reporting transactions. There are, however, certain Restrictions that apply to certain transactions, depending on their internal structure.
    No transaction variants are possible with transactions already containing preset parameters (parameter transactions and variant transactions).
    Regards
    Anji

  • Transaction With RFC JCO

    Hi guys,
    I call a rfc who call a bapi function.
    But, if I get a error message from sap I need to do the rollback in sap and in my application.
    In my application no problems, but, how can I do rollback at SAP?
    Can I work with transactions???

    Hi edney,
    You can do this by using the <b>BAPI_TRANSACTION_COMMIT</b> and <b>BAPI_TRANSACTION_ROLLBACK</b> BAPIs. They are used for handling transactions on BAPI calls. They are listed under the BAPIService node in the BAPI explorer. Refer to the following tutorial for  handling transactions with BAPIs in webdynpro, though you might not be using webdynpro, but it will help you understand the whole thing.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/20b6e990-0201-0010-5095-f3a465de5f30">Handling Transactions with BAPIs in Web Dynpro</a>
    Best regards,
    Guru.

  • Distributed transactions with container-managed MDBs

              I have built a framework that employs a high rate of code reuse while abstracting
              the complexities of inter-application communication. This allows application
              developers to focus on solving their business needs and not worry about "the plumbing"
              between the applications.
              At this point, the framework is using container-managed MDBs for Topic destinations.
              MDBs were chosen because of their concurrent nature for processing JMS messages.
              Now that I have this framework up and running, I am trying to add distributed
              transaction support and am having trouble understanding what I need to do. Here
              is how the framework works:
              The MDB will recieve a message, unmarshall it into a business object, and then
              route that object to the appropriate business class where it is then processed
              accordingly. In most cases, the processing of this message object will require
              database interaction. If any error should occur while processing the message,
              all XAResources within the transaction should rollback and ultimately, the JMS
              message will be redelivered later.
              Here is what I'm trying to find out:
              1. When control is passed to an application and it gets a DB connection, will
              that DB resource be dynamically enlisted with the transaction?
              2. Must the DB connection come from the WLS DB pool to be enlisted with the transaction?
              I ask this because the current standard at this company is to use a home-grown
              DB connection pool for getting DB connections. This is due to the fact that not
              all applications here run in a WLS environment and they wanted a standard way
              of retrieving a DB connection across applications. They also sited problems with
              WLS 4.5.1 connection pool.
              3. The documentation states that only one database may be involved in a transaction.
              If a connection to another database is required, but not needed in the current
              transaction, will WLS ignore enlisting the 2nd DB resource, or throw an exception?
              4. Where can I find <B>detailed</B> information about this subject? Everything
              that I have read so far has barely scratched the surface for this specific topic.
              Thanks,
              Bob.
              

              Hi Bob,
              If you are using WLS's XA connection pool, then the XAResource associated with
              the XA connections are enlisted with the transaction transparently for you. Enlistments
              actually occur not at getConnection, but on demand when the JDBC objects are actually
              used.
              If you are not using WLS connection pools, then you would need to enlist the XAResource
              associated with the XA connections yourself. You can obtain the transaction associated
              with the current thread by calling weblogic.transaction.TxHelper.getTransaction(),
              and then call enlistResource on the transaction.
              Weblogic has provisions that allow one (and only one) non-XA connection pool to
              participate in a distributed transaction. In this case, you will get a SQLException
              when you try to obtain a connection from a second connection pool in the same
              distributed transaction. However, if you are using real XA connection pools,
              there is no limitation and any number of XA connection pools can participate in
              the same distributed transaction.
              We will try to incorporate more info in our online docs in the future.
              -- Priscilla Fung, BEA Systems, Inc.
              "Bob Peroutka" <[email protected]> wrote:
              >
              >I have built a framework that employs a high rate of code reuse while
              >abstracting
              >the complexities of inter-application communication. This allows application
              >developers to focus on solving their business needs and not worry about
              >"the plumbing"
              >between the applications.
              >
              >At this point, the framework is using container-managed MDBs for Topic
              >destinations.
              > MDBs were chosen because of their concurrent nature for processing JMS
              >messages.
              >
              >Now that I have this framework up and running, I am trying to add distributed
              >transaction support and am having trouble understanding what I need to
              >do. Here
              >is how the framework works:
              >
              >The MDB will recieve a message, unmarshall it into a business object,
              >and then
              >route that object to the appropriate business class where it is then
              >processed
              >accordingly. In most cases, the processing of this message object will
              >require
              >database interaction. If any error should occur while processing the
              >message,
              >all XAResources within the transaction should rollback and ultimately,
              >the JMS
              >message will be redelivered later.
              >
              >Here is what I'm trying to find out:
              >
              >1. When control is passed to an application and it gets a DB connection,
              >will
              >that DB resource be dynamically enlisted with the transaction?
              >
              >2. Must the DB connection come from the WLS DB pool to be enlisted with
              >the transaction?
              >
              >I ask this because the current standard at this company is to use a home-grown
              >DB connection pool for getting DB connections. This is due to the fact
              >that not
              >all applications here run in a WLS environment and they wanted a standard
              >way
              >of retrieving a DB connection across applications. They also sited problems
              >with
              >WLS 4.5.1 connection pool.
              >
              >3. The documentation states that only one database may be involved in
              >a transaction.
              > If a connection to another database is required, but not needed in the
              >current
              >transaction, will WLS ignore enlisting the 2nd DB resource, or throw
              >an exception?
              >
              >4. Where can I find <B>detailed</B> information about this subject?
              > Everything
              >that I have read so far has barely scratched the surface for this specific
              >topic.
              >
              >Thanks,
              >
              >Bob.
              

  • Marking the transaction as rollback in JPD

    I have a stateless JPD (with Client Request with Return as the start node).
    If an exception is thrown anywhere in the JPD and "remains" unhandled the transaction
    rollbacks automatically - which is desired. However any piece that happens as
    a result is that the Process is marked as "Aborted" (on the WLI admin console)
    and the client gets a runtime unhandled exception (SOAP Fault)- which is not wan't
    I wan't to return to the client as a JPD developer.
    So I am stuck as I wan't the transaction to rollback but at the same time I wan't
    to send a more user friendly response (say an XML contract) with the error details....
    I am using WLI 8.1 SP2.
    BEA folks - please speak up ... Do you guys have any inside info. that you could
    please share or point to!
    Thanks very much

    Hi Ric,
    Thanks for your input. Although this document has aided my undertanding of state management and connection pooling, I am still none the wiser as to why I am experiencing this issue.
    On closer inspection I have found that the doDML(int, TransactionEvent) is not being called until I insert a row.
    So if I query my master VO, set the first row to current, update an attribute on a detail row then postChanges on the transaction, doDML does not get called.
    If I insert a row into my detail VO then postChanges on the transaction, it calls doDML issuing the original update I entered in the above step.
    It seems I have a similar problem to the that described in the following thread but there seems to be no outcome.
    Re: doDML() not called at postChanges?
    In my desparation, I am tempted to just insert a row and then remove it just to put the EO's in the correct state if the user updates a row before inserting a new one.
    Any help would be greatly appreciated.
    Thanks.

  • Unable to use transactions with System.Data.OracleClient data provider

    I am using VS2008, System.Data.OracleClient, Oracle 10g, and ODAC 10.2.0.20. I haven't been able to get transactions to work. When I use 'connection.BeginTransaction()', the rollback doesn't work. When I use TransactionScope, the output parameter is always DBNull. Any ideas/comments?
    Here's the sample code:
    // #define ENABLE_TRANSACTION // failure is 'rollback not working'
    #define ENABLE_TRANSACTION_SCOPE // failure is 'no output parameter value'
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Text;
    using System.Data.OracleClient;
    #if ENABLE_TRANSACTION_SCOPE
    using System.Transactions;
    #endif
    namespace TestOracleTransaction
    class Program
    static void Main(string[] args)
    #if ENABLE_TRANSACTION_SCOPE
    using (TransactionScope scope = new TransactionScope())
    #endif
    string connectionString = "Data Source=ORADEV;User ID=user;Password=pwd";
    using (OracleConnection connection = new OracleConnection(connectionString))
    try
    connection.Open();
    #if ENABLE_TRANSACTION
    using (OracleTransaction transaction = connection.BeginTransaction())
    #endif
    try
    #if ENABLE_TRANSACTION_SCOPE
    if (Transaction.Current == null)
    throw new ArgumentException("no ambient transaction found for OracleClient");
    #endif
    OracleCommand command = connection.CreateCommand();
    #if ENABLE_TRANSACTION
    command.Transaction = transaction;
    #endif
    command.CommandType = CommandType.StoredProcedure;
    command.CommandText = "TIS.P_TIS_GATEWAY_INFO_ADD";
    OracleParameter param = command.CreateParameter();
    param.ParameterName = "p_gateway_id";
    param.Direction = ParameterDirection.Input;
    param.DbType = DbType.Int64;
    param.Value = 18;
    command.Parameters.Add(param);
    param = command.CreateParameter();
    param.ParameterName = "p_info_id";
    param.Direction = ParameterDirection.Input;
    param.DbType = DbType.Int64;
    param.Value = 79;
    command.Parameters.Add(param);
    param = command.CreateParameter();
    param.ParameterName = "p_user";
    param.Direction = ParameterDirection.Input;
    param.DbType = DbType.String;
    param.Value = "spms";
    command.Parameters.Add(param);
    param = command.CreateParameter();
    param.ParameterName = "p_gateway_info_id";
    param.Direction = ParameterDirection.Output;
    param.DbType = DbType.Int64;
    param.Size = sizeof(Int64);
    command.Parameters.Add(param);
    int count = command.ExecuteNonQuery();
    object value = command.Parameters["p_gateway_info_id"].Value;
    long id = (value == DBNull.Value) ? -1 : Convert.ToInt64(value);
    if (id < 0)
    // FAILURE - no output parameter value when TransactionScope enabled
    throw new ArgumentException("no return value");
    #if ENABLE_TRANSACTION
    // FAILURE - rollback doesn't work when Transaction enabled
    transaction.Rollback();
    #endif
    #if ENABLE_TRANSACTION_SCOPE
    scope.Complete();
    #endif
    catch (Exception ex)
    System.Console.WriteLine("ERROR: " + ex.Message);
    #if ENABLE_TRANSACTION
    transaction.Rollback();
    #endif
    finally
    if (connection.State == ConnectionState.Open)
    connection.Close();
    }

    Hi,
    First, this is not the place for questions with System.Data.OracleClient, this is the Oracle Data Provider for .NET forum. Having said that I went ahead and tested your code with some slight modifications because you did not provide the stored procedure information. I am assuming your stored procedure is doing some sort of DML since you are using transactions and attempting to commit and rollback.
    I tested the following with both Transaction scope and a local transaction object and it worked fine with System.Data.OracleClient. I provided the create table and stored procedure I used.
    Observations
    ========
    When using transaction scope, a distributed transactions was executed and the data was inserted and returned in the output variable.
    From console
    p1 value is Hello World
    From SQL Plus
    SQL> select * from foo;
    C1
    Hello World
    When using a local transaction, the DML was not inserted when calling rollback and when I changed it to commit, the row was inserted successfully.
    Maybe you can test the simple foo example below to see if it works for you. Maybe there is something going on in your SP that is causing your specific observations.
    The code I posted at this point is using local transaction and calling transaction.commit(), rollback is commented out. But I tested all scenarios and they worked as expected.
    HTH
    Jenny
    #define ENABLE_TRANSACTION // failure is 'rollback not working'
    //#define ENABLE_TRANSACTION_SCOPE // failure is 'no output parameter value'
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Text;
    using System.Data.OracleClient;
    #if ENABLE_TRANSACTION_SCOPE
    using System.Transactions;
    #endif
    create table foo (c1 varchar2(50));
    create or replace procedure getstr (p1 out varchar2) as
    begin
    insert into foo(c1) values ('Hello World') returning c1 into p1;
    end;
    namespace TestOracleTransaction
    class Program
    static void Main(string[] args)
    #if ENABLE_TRANSACTION_SCOPE
    using (TransactionScope scope = new TransactionScope())
    #endif
    string connectionString = "Data Source=orcl;User ID=scott;Password=tiger";
    using (OracleConnection connection = new OracleConnection(connectionString))
    try
    connection.Open();
    #if ENABLE_TRANSACTION
    using (OracleTransaction transaction = connection.BeginTransaction())
    #endif
    try
    #if ENABLE_TRANSACTION_SCOPE
    if (Transaction.Current == null)
    throw new ArgumentException("no ambient transaction found for OracleClient");
    #endif
    OracleCommand command = connection.CreateCommand();
    #if ENABLE_TRANSACTION
    command.Transaction = transaction;
    #endif
    command.CommandType = CommandType.StoredProcedure;
    command.CommandText = "SCOTT.GETSTR";
    OracleParameter param = command.CreateParameter();
    param.ParameterName = "p1";
    param.Direction = ParameterDirection.Output;
    param.DbType = DbType.AnsiString;
    param.Size = 20;
    command.Parameters.Add(param);
    int count = command.ExecuteNonQuery();
    object value = command.Parameters["p1"].Value;
    Console.WriteLine("p1 value is {0}",value.ToString());
    #if ENABLE_TRANSACTION
    // FAILURE - rollback doesn't work when Transaction enabled
    transaction.Commit();
    //transaction.Rollback();
    #endif
    #if ENABLE_TRANSACTION_SCOPE
    scope.Complete();
    #endif
    catch (Exception ex)
    System.Console.WriteLine("ERROR: " + ex.Message);
    #if ENABLE_TRANSACTION
    transaction.Rollback();
    #endif
    finally
    if (connection.State == ConnectionState.Open)
    connection.Close();
    }

  • Doing transactions with MyISAM tables

    On Feb. 24, a question was asked about using cftransaction
    with MySQL. That person's answer was to convert the tables to
    InnoDB.
    I have three tables that must stay "in lockstep". When I add
    a row to one table, I have to add rows to the other two. If they
    get out of sync, one of the queries runs excruciatingly slow.
    I tried wrapping them in a cftransaction, but now find out
    that it didn't really do any good because the table format is still
    MyISAM. Is there anything I can do (short of altering the tables)
    to do transactions?
    Is there a way to get MySQL to process the transactions
    "manually". Do I have to do a series of "trys" and "catches" with a
    commit or rollback for each one? Do you know of a place where I can
    see code like that?
    It would be nice if I were just missing something and someone
    could tell me how to do transactions with MyISAM tables. But, I'll
    do whatever is necessary to avoid having the tables get out of
    sync.
    Thanks.

    After making a copy of the tables:
    I used MySQLAdmin to convert each of the tables to InnoDB. It
    displayed the correct "alter table table_name type=innobd;" box
    before each change.
    Before the changes, the three tables showed the same record
    count. After the changes, they were wildly different. But, (with no
    changes to the web pages) the application opens OK and I can call
    up records. Did the conversion get rid of some records or what?
    Also, one of the pages (that uses a lot of convoluted logic
    for the display) takes a lot longer to appear than it used to. All
    the other pages are open fine and display their forms, etc..
    Updates seem a little slower, but not too bad.
    Why is the record count different in the three tables? Why
    might the one page be running slower? (Do I need to make any
    changes in the original web page code?)
    Prior to the conversion, the three MyISAM tables (*.MYD,
    *.MYI, & *.frm) were all stored in the C:\\Program
    Files\MySQL\MySQL Server 5.0\data\my_data directory. Now that
    directory only holds ".frm" files. Where did the conversion put the
    new tables?
    I haven't yet tested the cftransactions to verify they work.
    That's next.
    Thanks.

  • Create transaction with variant not working

    Hello!
    Here's my issue -- I have a program that, right now, is more of a shell than anything else.  It is to access the HR Logical Database PNPCE, and to help filter the data I pull back, I created a Selection View with a couple of additional fields.  I put the necessary values in these fields and saved it as a Variant.
    All I want to do is create a transaction to run my program and start it using my Variant to fill in these additional fields.  Using SE93, I can create a plain transaction with no problem.  However, if I click the "Start with variant" drop-down field, I get a response that says screen 1000 (my default Selection Screen) has no variants.
    At first we thought there was some client-side things needing configuration, but if I go create a quick-and-dirty program with a single Selection Screen value (no Selection View) and a Variant, SE93 sees the variant with no problems.  So I'm wondering if maybe it has something to do with the fact that I'm using a Selection View.  Unfortunately, I'm so new to ABAP, I'm completely stuck on how to proceed.
    Any suggestions?  Thank you so much!

    Saquib, thank you SO much!  You're right -- that worked.
    As a relative newbie to SAP R/3 and ABAP, I'm new to little quirks like this.  In other examples, the list (F4) does show the variants.  For some reason, this one didn't.  I entered it anyway, saved, and ran the transaction, and it popped up with the fields populated from the variant.
    Again, kudos and thank you so much.  Points duly awarded.

Maybe you are looking for

  • Difficulty Importing a Properly Sized TIFF image (I think)

    Hello, I am having difficulty importing an appropriately sized TIFF image that is a screen shot from my film.  It seems to be a resizing issue of some sort. The TIFF image is a straight frame grab from my film, which is sized 1920 x 1080. here is the

  • Displaying a vector in jsp

    I'm returning a vector, but I'm having trouble displaying it. The vector will contain a group of users, each containing FirstName, LastName and EmailAddress. I've the servlet working, but the I'm having trouble repeating the vector. <!doctype html pu

  • Variable for prior 36 months

    Hi all, I need to create a required variable to get the prior 36 months of data EXCLUDING the current month. Can someone help me with this? Thanks, Angie

  • About the connection destination change of Salesforce of Crystal Report

    Hi There are three kinds of Salesforce about Developer Edition, sandbox environment, and deploy environment(operation environment). In an in-house data base (SQLServer and Oracle), when it changes the database connectivility ahead, "connection string

  • Application to track usage while on Passport plan

    Hey there I'd be happy to help with tracking your usage! One option to track your usage will be the myAT&T app which will detail your remaining usage available. If you need an immediate update on usage, I would recommend using options available on th