Multiple Connections in one transaction?

Hello,
we use the OC4J 9.0.3 with the fellowing DataSource configuration:
<data-source
class="oracle.jdbc.pool.OracleConnectionCacheImpl"
name="OracleDS"
location="jdbc/OracleCoreDS"
xa-location="jdbc/xa/OracleXADS"
ejb-location="jdbc/OracleDS"
connection-driver="oracle.jdbc.driver.OracleDriver"
username="xxx"
password="xxx"
url="jdbc:oracle:thin:@10.50.40.17:1521:vbstest"
inactivity-timeout="30"
max-connections="30"
/>
In our project we use CMP/BMP-Entitybeans and CMR. During a complex update we got a SQL-Exception with the message, that a foreign key constrain has been violated (primary key does not exist, even it has been inserted in the same transaction). Because we know, that the same code runs on JBoss 3.0, we have assumed that OC4J use more than one connection and so we have enabled the connection debug.
The result is, that OC4J created in one transaction more that 6 connections. All beans using the same datasource.
Is there is a way to configure this beavior? Or someone have a idea, why OC4J use more than one connection in one tranaction?
Here the connection debug log:
2003-03-18 10:42:31,162 DEBUG (10.50.40.115-ruethja-0) [VDDBean_PersistenceManager11] Connection: [Connection : com.evermind.sql.OrionCMTConnection@a1fa8e]
2003-03-18 10:42:31,602 DEBUG (10.50.40.115-ruethja-0) [DienststelleBeanImpl_PersistenceManager73] Connection: [Connection : com.evermind.sql.OrionCMTConnection@7a6aa8]
2003-03-18 10:42:32,433 DEBUG (10.50.40.115-ruethja-0) [VorgangBeanImpl_PersistenceManager41] Connection: [Connection : com.evermind.sql.OrionCMTConnection@1af986c]
2003-03-18 10:42:32,483 DEBUG (10.50.40.115-ruethja-0) [VDDBean_PersistenceManager11] Connection: [Connection : com.evermind.sql.OrionCMTConnection@1d372d7]
2003-03-18 10:42:32,674 DEBUG (10.50.40.115-ruethja-0) [VorgangBeanImpl_PersistenceManager41] Connection: [Connection : com.evermind.sql.OrionCMTConnection@8b64b3]
2003-03-18 10:42:32,724 DEBUG (10.50.40.115-ruethja-0) [DienststelleBeanImpl_PersistenceManager73] Connection: [Connection : com.evermind.sql.OrionCMTConnection@1e0e2ba]

could you post the source of session bean may be i can help you then
regards,
ashish saraf

Similar Messages

  • Two jdbc connections in one transaction

    Hi<br>
              <br>
              In a method of a container managed ejb session bean I have two jdbc connections. I've expected, that they will be in the same transaction, so results of any actions performed with first connection will be visible for the second connection, but it is not. <br>
              I've checked, that there are two sessions at the database, so it seams that there are simply separate transactions. Is it a problem with a ejb-jar.xml (will paste it later), datasource (driver - Oracle Thin non-XA; 1PC selected) or such behaviour can not be achieved in WLS ? <BR>
              <BR>
              regards
              <br>
              <BR><?xml version="1.0" encoding="UTF-8"?>
              <BR>
              <BR><!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
              <BR>
              <BR><ejb-jar >
              <BR>
              <BR>     <description><![CDATA[No Description.]]></description>
              <BR>     <display-name>ConnectionTest1</display-name>
              <BR>     
              <BR>     <enterprise-beans>
              <BR>          <session >
              <BR>               <description><![CDATA[]]></description>
              <BR>               
              <BR>               <ejb-name>ConnectionTest1</ejb-name>
              <BR>               
              <BR>               <home>pl.axit.test.ConnectionTest1Home</home>
              <BR>               <remote>pl.axit.test.ConnectionTest1</remote>
              <BR>     <ejb-class>pl.axit.test.ConnectionTest1Bean</ejb-class>
              <BR>     <session-type>Stateless</session-type>
              <BR>     <transaction-type>Container</transaction-type>
              <BR>     
              <BR>     <resource-ref >
              <BR>          <res-ref-name>jdbc/wowrite</res-ref-name>
              <BR>          <res-type>javax.sql.DataSource</res-type>
              <BR>          <res-auth>Container</res-auth>
              <BR>     </resource-ref>
              <BR>     </session>
              <BR>     </enterprise-beans>     
              <BR>     
              <BR>     <assembly-descriptor>
              <BR>          <container-transaction>
              <BR>               <description/>
              <BR>               <method>
              <BR>                    <description/>
              <BR>                    <ejb-name>ConnectionTest1</ejb-name>
              <BR>                    <method-name>*</method-name>
              <BR>               </method>
              <BR>               <trans-attribute>Required</trans-attribute>
              <BR>          </container-transaction>          
              <BR>
              <BR>     </assembly-descriptor>
              <BR></ejb-jar>

    Hi,
              are you using XA transactions? Two separate JDBC Connections treated
              within one transactional context will require two phase commit (via
              Emulation or an XA database driver) Please check the connections
              settings within your datasources.
              Rgds,
              Axel van Lil (LMIS.de)
              Lukas Uruski schrieb:
              > I forgot to add, that in administration console in server_name > Monitoring > JTA parameter "Transactions Total Count" increases by one each time method from previous post is invoked.

  • Multiple connections in one project

    Hi,
    Is there perhaps some kind of a document describing a 'best practice' for using multiple connections in a ADF BC application. One connects to an oracle DB another to a SQLServer.
    I suppose I need to create two different services? Anybody having experience with this?
    Regards,
    Koen Verhulst

    Among other things, the BC4J Configuration defines the name of the JDBC connection to use. To solve your problem, you can create two Configurations one for each database. The JDBC connection value will be the only different element between these two Configurations. To create a BC4J Configuration in JDeveloper, right click on the AppModule node and then click Configurations...,
    Use oracle.jbo.client.Configuration class to create AppModules connected to the database you want.,
    import oracle.jbo.*;
    import oracle.jbo.client.Configuration;
    String am = "demo.DemoModule"; // Fully-qualified application module name
    // Configuration name with JDBC connection to source database
    String cf1 = "DemoModuleSourceDb";
    ApplicationModule amSrc = Configuration.createRootApplicationModule(am,cf1);
    // Configuration name with JDBC connection to dest database
    String cf2 = "DemoModuleDestDb";
    ApplicationModule amDest = Configuration.createRootApplicationModule(am,cf2);
    Note that the AM name can also be different if you want.
    Hope this helps,
    Sathish.
    I want to access several Databases from one BC4J-Project.
    For example I want to write an application, which collects data from one database, does some computation and stores the results in a second database.
    I would prefer to use BC4J-Components for both, the source and the target database, but unfortunately I can select only one connection per BC4J-Project.
    Has anyone got an idea, how I can access more than one database-connection from one BC4J-Project without having to write all the JDBC-Stuff on my own? JDev-Team, can you please give a hint?

  • Multiple connections in one app

    Hi,
    I have a web app and am using JDev 10.1.3.2 with ADFBC. Some of the data will come from SQL2000 while other info will come from Oracle 10g. My UI will require presentation of a mix. But I am only able (it appears) to use one db connection in one project. What's the best way to address using multiple datasources?
    Thanks!
    Ginni

    hi ginnim
    Maybe this blog story by Steve Muench could be of some help:
    "How Granular Should My Application Modules Be?"
    http://radio.weblogs.com/0118231/stories/2005/05/27/howGranularShouldMyApplicationModulesBe.html
    success
    Jan Vervecken

  • Changing properties of multiple resources in one transaction

    Hi,
    Does anyone have an idea how to change a property in multiple resources in one atomic transaction. 
    There are some interesting comments regarding the use of "mass calls" in various SAP documents but not really anything specific.
    The changing of one property in multiple resources is not the problem.  This is easy.  The challenge is the operation in one transaction.   There is a ITransactionManager in the KM Javadoc but this looks like more of an internal class.
    Thanks.
    Dick

    Does this imply that the properties of these selectors can be modified simultaneously?
    Correct.

  • Multiple connections in one BC4J Project

    I want to access several Databases from one BC4J-Project.
    For example I want to write an application, which collects data from one database, does some computation and stores the results in a second database.
    I would prefer to use BC4J-Components for both, the source and the target database, but unfortunately I can select only one connection per BC4J-Project.
    Has anyone got an idea, how I can access more than one database-connection from one BC4J-Project without having to write all the JDBC-Stuff on my own? JDev-Team, can you please give a hint?

    Among other things, the BC4J Configuration defines the name of the JDBC connection to use. To solve your problem, you can create two Configurations one for each database. The JDBC connection value will be the only different element between these two Configurations. To create a BC4J Configuration in JDeveloper, right click on the AppModule node and then click Configurations...,
    Use oracle.jbo.client.Configuration class to create AppModules connected to the database you want.,
    import oracle.jbo.*;
    import oracle.jbo.client.Configuration;
    String am = "demo.DemoModule"; // Fully-qualified application module name
    // Configuration name with JDBC connection to source database
    String cf1 = "DemoModuleSourceDb";
    ApplicationModule amSrc = Configuration.createRootApplicationModule(am,cf1);
    // Configuration name with JDBC connection to dest database
    String cf2 = "DemoModuleDestDb";
    ApplicationModule amDest = Configuration.createRootApplicationModule(am,cf2);
    Note that the AM name can also be different if you want.
    Hope this helps,
    Sathish.
    I want to access several Databases from one BC4J-Project.
    For example I want to write an application, which collects data from one database, does some computation and stores the results in a second database.
    I would prefer to use BC4J-Components for both, the source and the target database, but unfortunately I can select only one connection per BC4J-Project.
    Has anyone got an idea, how I can access more than one database-connection from one BC4J-Project without having to write all the JDBC-Stuff on my own? JDev-Team, can you please give a hint?

  • How can I purchase multiple songs in one transaction?

    I have about 40 songs in my wishlist and I'd like to purchase some of them (not all at this time); is there a way to select multiple songs for purchase so I only have one charge on my card versus a bunch of individual charges for each song?

    Hi,
    For implementinq and using 2-phase commit using TUXEDO, u need to setup the following:
    1. Create separate Tuxedo Server groups each with an OPENINFO pointing to different databases.
    2. Distribute ur Tuxedo servers among these Tuxedo Groups to match the correct database these servers want.
    The thumd rule is that all Tuxedo servers belonging to a Tuxedo Server Group can access only one Resource
    Manager using the XA interface. Thats why, the OPENINFO connect information are specified at GROUP level
    and servers belong some Tuxedo server group.
    And now, you r all set for some real action.
    Write a client,
    Start a Global Transaction (tpbegin)
    Now call services from different tuxedo groups
    Commit or Rollback (tpcommit or tpabort)
    TMSes will take care that ur commits and rollbacks are consistent across different databases.
    If u need some help, feel free to write to me off the list.
    Good Luck!
    MS

  • Multiple connection in one form, is it possible?

    Im trying to access two different database (P.O.7 and the other is an ODBC Compliant) in one form.
    First thing i did was to run the wizard on each block using different login (1 for my PO7 and also the other) and it was successful, but when I try to execute the form, it just cant recognized the other block! since im only connected to other datasource....
    Any suggestion on what should i do with this....

    Check out the EXEC_SQL command under help in Forms
    The EXEC_SQL package allows you to access multiple Oracle database servers on several different connections at the same time. Connections can also be made to ODBC data sources via the Open Client Adapter (OCA), which is supplied with Developer. To access non-Oracle data sources, you must install OCA and an appropriate ODBC driver.
    The EXEC_SQL package contains procedures and functions you can use to execute dynamic SQL within PL/SQL procedures. Like the DBMS_SQL package, the SQL statements are stored in character strings that are only passed to or built by your source program at runtime. You can issue any data manipulation language (DML) or data definition language (DDL) statement using the EXEC_SQL package.

  • BUG: Adding a new parent with multiple children in one transaction

    Technology scope: JDeveloper Studio Edition Version 11.1.1.0.2, ADF Business Components.
    If you have a master-detail page (where master and detail views are both updateable tables) and you insert
    a new master record (without committing it) and you continue with inserting two or more child records you’ll receive
    the following error when I commit the transaction:
    java.sql.SQLIntegrityConstraintViolationException: ORA-02291: Integriteitsbeperking (PUBLICSUITE.DREXTRL_LANG_DREXTRL_FK1) is geschonden - bovenliggende sleutel is niet gevonden.
    ORA-06512: in regel 1
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:85)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:116)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:177)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:191)
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:944)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3462)
    at oracle.jdbc.driver.OracleCallableStatement.executeUpdate(OracleCallableStatement.java:3877)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1349)
    at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:434)
    at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:7779)
    at axi.casemanagement.model.base.CMEntityImpl.doDML(CMEntityImpl.java:62)
    at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:6162)
    at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:3253)
    at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:3061)
    at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:2180)
    at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2382)
    at oracle.adf.model.bc4j.DCJboDataControl.commitTransaction(DCJboDataControl.java:1565)
    at oracle.adf.model.dcframe.LocalTransactionHandler.commit(LocalTransactionHandler.java:140)
    at oracle.adf.model.dcframe.DataControlFrameImpl.commit(DataControlFrameImpl.java:597)
    at oracle.adfinternal.controller.util.model.DCFrameImpl.commit(DCFrameImpl.java:83)
    at oracle.adfinternal.controller.activity.TaskFlowReturnActivityLogic.resolveTransaction(TaskFlowReturnActivityLogic.java:509)
    at oracle.adfinternal.controller.activity.TaskFlowReturnActivityLogic.execute(TaskFlowReturnActivityLogic.java:114)
    at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:834)
    at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:718)
    at oracle.adfinternal.controller.engine.ControlFlowEngine.routeFromActivity(ControlFlowEngine.java:491)
    at oracle.adfinternal.controller.engine.ControlFlowEngine.performControlFlow(ControlFlowEngine.java:108)
    at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:86)
    at org.apache.myfaces.trinidadinternal.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:43)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
    at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
    at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:142)
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:70)
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:274)
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:74)
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:70)
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:274)
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:74)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:754)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:282)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:175)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:181)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:279)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:239)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:196)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:102)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:65)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:149)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Important notes:
    - This error occurs only if you insert multiple children, if you insert just one child in the same transaction everything works fine.
    - We have tested this application directly via "Run" BC application module and there everything works fine just like it hast to be.
    - Because we have a “Composed” association we don’t need to override the postChanges() method in order to controls the order for saving the entities (regarding the documentation).
    - Related to thread: http://forums.oracle.com/forums/thread.jspa?threadID=897936&tstart=30

    Gert,
    I think Frank's suggestion was that you file the test case with Oracle Support (Metalink) ;)
    John

  • Delete all the user connected to one transaction.

    During some periods, we need to lock some transaction to avoid user modify data while we are processing some critical jobs.
    If the users are yet in the transaction when we lock the transaction they are not removed from the transaction and we need to kill them manually from SM04 transaction in each application server.
    I have been trying to adapt the RSM04000_ALV program to do this but i'm stuck with the use of the pooled session.
    I guess that the system when you select the session and click on end session, it mark in anyplace something to indicate to the fuction module TH_DELETE_USER that when the option ONLY_POOLED_USER is enable, only that session need to be killed.
    Anybody know how this works? someone have a similar fuctionality in you system?

    Hello
    Try this:
      DATA: BEGIN OF SERVER_LIST OCCURS 0.
              INCLUDE STRUCTURE MSXXLIST.
      DATA: END OF SERVER_LIST.
      DATA: BEGIN OF USER_LIST OCCURS 0.
              INCLUDE STRUCTURE UINFO.
      DATA: END OF USER_LIST.
      DATA: BEGIN OF USER_LIST1 OCCURS 0.
              INCLUDE STRUCTURE UINFO.
      DATA: END OF USER_LIST1.
      DATA: USER_TERM LIKE RFCDISPLAY-RFCHOST.
      CALL FUNCTION 'TH_SERVER_LIST'
           TABLES
                LIST   = SERVER_LIST
           EXCEPTIONS
                OTHERS = 1.
      LOOP AT SERVER_LIST.
        CALL FUNCTION 'TH_USER_LIST'
             DESTINATION SERVER_LIST-NAME
             TABLES    LIST = USER_LIST1.
        APPEND LINES OF USER_LIST1 TO USER_LIST.
        REFRESH USER_LIST1.
        LOOP AT USER_LIST WHERE TCODE = 'YOUR T-CODE'.
                CALL FUNCTION 'TH_DELETE_USER' DESTINATION SERVER_LIST-NAME
                 EXPORTING
                    USER            = USER_LIST-BNAME
                    CLIENT          = SY-MANDT
                    TID             = USER_LIST-TID
                 EXCEPTIONS
                    AUTHORITY_ERROR = 1
                    OTHERS          = 2.
        ENDLOOP.
      ENDLOOP.

  • Advise on using DBMS_XA with multiple branches under one global transaction

    Dear all
    I need some advise on using DBMS_XA from PL/SQL with tightly coupled multiple branches under one global transaction. Basically, I've successfully written some PL/SQL code that in 3 different sessions attaches to 3 different branches of one global transaction and before ending each branch they can see each others uncommitted data. So far so good.
    However, I'm not sure I completely understand how each branch must call xa_end, xa_prepare and xa_commit correctly using two phase commit and my calls result in errors like:
    ORA-24767: transaction branch prepare returns read-only (XA error code 3 = Transaction was read-only and has been committed)
    ORA-24756: transaction does not exist (XA error code -4 = XID is not valid)
    ORA-02051: another session or branch in same transaction failed or finalized
    This is the structure of my programs (3 SQL*Plus sessions):
    main: Uses xid 123|0 (branch 0 of global transaction 123). This should be the coordinator that commits using two phase commit across the 3 branches
    m1.xa_start tmnoflags
    m2.DML
    m3.Wait for thread A + B to manually be started and run xa_end
    m4.xa_end tmsuccess
    m5.xa_prepare
    m6.xa_commit false
    thread A: Uses xid 123|A (branch A of global transaction 123)
    a1.xa_start tmnoflags
    a2.DML -- thread A can see main and thread B's data
    a3.xa_end tmsuccess
    a4.xa_prepare -- required?
    a5.Should we also call xa_commit false?
    thread B: Uses xid 123|B (branch B of global transaction 123)
    b1.xa_start tmnoflags
    b2.DML -- thread B can see main and thread A's data
    b3.xa_end tmsuccess
    b4.xa_prepare -- required?
    b5.Should we also call xa_commit false?
    The failing steps are:
    m5
    m6
    a4
    a5
    b4
    b5
    Before starting calling xa_end I see 3 rows in V$GLOBAL_TRANSACTION, eg (hex 7B = decimal 123):
    FORMATID GLOBALID BRANCHID BRANCHES REFCOUNT PREPARECOUNT STATE FLAGS COUPLING
    203348753 0000007B 00000000000000000000000000000000 3 3 0 ACTIVE 0 TIGHTLY COUPLED
    203348753 0000007B 0000000000000000000000000000000A 3 3 0 ACTIVE 0 TIGHTLY COUPLED
    203348753 0000007B 0000000000000000000000000000000B 3 3 0 ACTIVE 0 TIGHTLY COUPLED
    Thanks a lot in advance.
    Cheers
    Finn

    OK, I've figured it out. This is poorly documented as it's not well explained how to handle the various return codes. Turns out that all but the last xa_prepare calls return dbms_xa.xa_rdonly (tightly coupled branches are combined -- "read only" optimization), the last one returns dbms_xa.xa_ok and this is when you should call xa_commit.
    Now my next problem is that DBMS_XA doesn't work from within jobs (DBMS_JOB and DBMS_SCHEDULER), which makes it very difficult to use DBMS_XA. My purpose of using DBMS_XA is to coordinate work across multiple sessions in one transaction but if I can't easily create the multiple sessions, I'm stuck.
    When called from a job, xa_start throws:
    ORA-24789: start not allowed in recursive call
    on Oracle 11.2. In Oracle 11.1 it works, but xa_end fails with
    ORA-25352: no current transaction
    so I guess in fact the xa_start call didn't really work either, even though it returned tm_ok.
    I'm now trying to find a workaround on how to use DBMS_XA from within jobs, please comment if you have any suggestions. Or if you have any suggestions on other means of establishing the concurrent sessions (I wouldn't like to resort to external programs that need username/password to connect as password management would be a security issue).
    Thanks in advance.
    Cheers
    Finn

  • Shall I use one datasource for multiple connection pool?

    Hi,
    I need to clarrify that, Shall I use one Datasource for multiple connection pool in distributed transaction?
    Thanks with regards
    Suresh

    No. If its transactions across multiple databases you should use different datasources.

  • 'SPROXY' - Multiple PI Systems connected to one ECC System for ABAP Proxies

    Dear Experts
    I am currently facing an issue when I want to connected multiple PI instances to one ECC client for
    ABAP Proxy purposes.
    In transaction 'SPROXY', in the Enterprise Service Brower, only one PI instance is shown and accessable.
    Can this setting be changed to allow multiple PI systems in this Enterprise Service Browser?
    Thanks for your ideas.
    Mathias

    Hi,
    Check these replies.
    R/3 connected to multiple XI instances
    'SPROXY' - Multiple PI Systems connected to one ECC System for ABAP Proxies
    Multiple XI Instances
    Multiple XI instances or multiple app server
    Thanks,
    Vijaya.
    Edited by: Vijaya Lakshmi Palla on Jun 4, 2008 11:43 AM

  • Problems with multiple connections in the same transaction

    Hi all !
              I'm have two questions regarding the way weblogic handles multiple
              connections.
              1) first, I don't understand why weblogic always create a new Managed
              Connection when I'm asking for 2 connection handles on the same connection
              factory and with the same connectionRequestInfo. Isn't it supposed to share
              connections ?
              For instance, the following snippet of code results in the creation of 2
              managed connections:
              ConnHandle conn1 = myCF.getConnection(myRequInfo);
              ConnHandle conn2 = myCF.getConnection(myRequInfo);
              The class corresponding to myRequInfo does implement the equals and hash
              method, so that weblogic's connection manager could use them to check that
              the queried connections are the same, and thus could share a single
              ManagedConnection between multiple connection handles. Apparantly it does
              not do that...
              2) OK, I just let weblogic create the 2 managed connections, but... My use
              of the connections is as part of a transaction. Here is what happens:
              ConnHandle conn1 = myCF.getConnection(myRequInfo);
              // a new managedConn1 is instanciated. the following happens (just a
              description)
              // xar1 = managedConn1.getXAResource()
              // xar1.start(NOFLAGS)
              // I use the conn1 handle
              conn1.close();
              //xar1.end(SUSPEND)
              ConnHandle conn2 = myCF.getConnection(myRequiInfo);
              // a new managed connection managedConn2 is instanciated.
              // xar2 = managedConn2.getXAResource();
              // xar2.start(RESUME)
              // I use conn2 handle
              conn2.close();
              // xar2.end(SUSPEND);
              // my bean returns from the remote invocation
              // the client of the bean asks to commit (using UerTransaction.commit on the
              client side)
              // xar2.end(SUCCESS)
              // xar2.commit(onePhase=true);
              // managedConn2.cleanup();
              And that's all. So, as one can see, managedConn1.cleanup was never called.
              When looking in the weblogic console, I can see that I have one connection
              with 0 handle and one with 1 handle, deemed as still being in a transaction.
              So, the conenction manager apparantly loses a managed connection during the
              transaction. And it's very very bad because after a couple of transactions,
              I'm running out of managed connections (I had set a limit of 10).
              Any one has seen such a weird behavior ? Is this a problem on my side, or
              weblogic's ? Thanks for your help.
              Sylvain
              

              I ran another test. This time I have a bean that makes use of a connector
              once per method invocation. The bean method invoked is "sayHello" and it
              gets a connection to the EIS, perform an operation on it and release it. The
              connector I developed uses XA transactions.
              My test client just calls 3 times myBean.sayHello().
              I can distinguish two cases:
              1) first, the client doesn't do transaction demarcation. In this case, since
              the sayHello method is marked as requiring transaction, the folowing happens
              in the bean:
              // **** first invocation of the bean
              connHandle = myCF.getConnection();
              // managedConn1 is instanciated
              // xar1 = managedConn1.getXAResource()
              // xar1.start(NOFLAGS);
              // managedConn1.getConnection gives a connection handle
              connHandle.doSomeWork();
              connHandle.close()
              // xar1.end(SUCCESS);
              // the bean returns from its invocation
              // xar1.commit(onePhase=true)
              // managedConn1.cleanup()
              // **** second invocation of the bean
              connHandle = myCF.getConnection();
              // managedConnectionFactory.matchManagedConnection is called. It returns the
              managed connection (managedConn1) that is in the passed set
              // xar1 = managedConn1.getXAResource()
              // xar1.start(NOFLAGS);
              // managedConn1.getConnection gives a connection handle
              connHandle.doSomeWork();
              connHandle.close
              // xar1.end(SUCCESS);
              // the bean returns from its invocation
              // xar1.commit(onePhase=true)
              // managedConn1.cleanup()
              // **** third invocation of the bean
              connHandle = myCF.getConnection();
              // managedConnectionFactory.matchManagedConnection is called. It returns the
              managed connection (managedConn1) that is in the passed set
              // xar1 = managedConn1.getXAResource()
              // xar1.start(NOFLAGS);
              // managedConn1.getConnection gives a connection handle
              connHandle.doSomeWork();
              connHandle.close
              // xar1.end(SUCCESS);
              // the bean returns from its invocation
              // xar1.commit(onePhase=true)
              // managedConn1.cleanup()
              2) second case : the client performs transaction demarcation. In that case,
              the connection manager instanciates 3 managed connections, calls start/end
              on each XAResource corresponding to each managed connection, calls commit
              once, but also calls cleanup only once, leaving 2 lost managed connections
              The client looks like this:
              UserTransaction utx = context.lookup("javax/transaction/UserTransaction");
              utx.begin();
              MyBean myBean = ctx.lookup(".......");
              myBean.sayHello();
              myBean.sayHello();
              myBean.sayHello();
              utx.commit();
              on the server the following happens:
              // **** first invocation of the bean
              connHandle = myCF.getConnection();
              // managedConn1 is instanciated
              // xar1 = managedConn1.getXAResource()
              // xar1.start(NOFLAGS);
              // managedConn1.getConnection gives a connection handle
              connHandle.doSomeWork();
              connHandle.close()
              // xar1.end(SUSPEND);
              // the bean returns from its invocation
              // **** second invocation of the bean
              connHandle = myCF.getConnection();
              // managedConn2 is instanciated
              // xar2 = managedConn2.getXAResource()
              // xar1.isSameRM(xar2) is called. returns true
              // xar2.start(RESUME);
              // managedConn2.getConnection gives a connection handle
              connHandle.doSomeWork();
              connHandle.close()
              // xar2.end(SUSPEND);
              // the bean returns from its invocation
              // **** third invocation of the bean
              connHandle = myCF.getConnection();
              // managedConn3 is instanciated
              // xar3 = managedConn3.getXAResource()
              // xar2.isSameRM(xar3) is called. returns true
              // xar3.start(RESUME);
              // managedConn3.getConnection gives a connection handle
              connHandle.doSomeWork();
              connHandle.close()
              // xar3.end(SUSPEND);
              // the bean returns from its invocation
              // the client invokes commit on the UserTransaction
              // xar3.end(SUCCESS);
              // xar3.commit(onephase = true);
              // managedConn3.cleanup();
              And so, managedConn1 and managedConn2 got lost in the way...
              What's more puzzling, it's that when monitoring my connector with the
              console, I can see that there are 3 connections. 2 declared as still having
              one handle used and being in transaction, and one not in transaction and
              with 0 active handle. BUT when monitoring the JTA part of the server, I can
              see that there has been 1 transaction that committed, and no connection is
              "in flight" as the console says. So, on one side the console says 2 managed
              connections are still part of a transaction while on the other it says that
              no transactions are currently in flight.
              Thanks for any kind of help on this very bizarre behavior.
              Sylvain
              

  • Control multiple updates and queries within one transaction in JPA

    Hi,
    I have a question regarding control multiple updates and queries within one transaction. We are using EclipseLink 2.3.1. With below code, will I be able to:
    - have all insert, update, select queries committed in one transaction;
    - queryGetBalance will return the latest OrgBalance after update;
    - if one fails, everything rolls back.
    Thanks!
    Jeffrey
    PS: I realized that I cannot use em.getTransaction().begin() and em.getTransaction().commit(), since I am using JTA.
    =============
    @PersistenceContext(unitName="Test")
    EntityManager em;
    em.setFlushMode(FlushModeType.COMMIT);
    newTransaction.setAmount(1000);
    newTransaction.setType("check");
    em.persist(newTransaction);
    orgAudit.setUpdateUser("Joe")
    orgAudit.setupUpdateTime(time);
    em.merge(orgAudit);
    Query queryUpdateBalance = em.createQuery("update OrgBalance o set o.balance = o.balance + :amount where orgId = :myOrgId");
    queryUpdateBalance.setParameter("amount", 1000);
    queryUpdateBalance.setParameter("myOrgId", 1234);
    Query queryGetBalance = em.createQuery("select OrgBalance o where o.orgId = :myOrgId");
    queryGetBalance.setHint("javax.persistence.cache.storeMode", CacheStoreMode.REFRESH);
    queryGetBalance.setHint("javax.persistence.cache.retrieveMode", CacheRetrieveMode.BYPASS);
    queryGetBalance.getResultList();
    em.flush();
    Edited by: JeffreyW on Dec 12, 2011 10:34 AM

    Yes, the operation will be in a single transaction, assuming you are using a JTA managed SessionBean and the code is part of a SessionBean method.

Maybe you are looking for

  • Fields recorded at formscentral does not match the field order in form

    Is it possible to change this? I know I can re-order them from within formscentral but is it possible to adjust form to send them in the right order in the first place? Thanks, D

  • Blackberry Desktop Software and 9800 Torch

    I attached my cellphone to my PC and I see it charging. I open Blackberrry Desktop Software but it acts like I need to connect my cellphone even though it is already connected. What do I have to do to get the software to recognize my 9800 Torch ?

  • Export a lightroom-edited foto as original to Photoshop

    Hello, normally when i edited a foto (CR2) in lightroom and i wanted to do some more complicated retouching work in photoshop i got an extra window where i was able to check if i wanted to export it as a copy with Lightroom-edits, a copy or the origi

  • How to build jar file in JBuilder 9?

    Hi, I created a jar file by Archive Builder in JBuilder 9, I chose Executive jar as I need to run it on windows 2000 server. It is good if it is an exe file. I right click the jar file and build it. However, it is still zero byte, no files are packag

  • Importing Shapes into Photoshop

    I'm trying to import an Adobe Shape into Photoshop.  The tutorial says to go to Photoshop, then Window, then CC libraries.  My Window tab does not display the CC libraries option.  What am I doing wrong?  Please help!