problem in 2 phase commit

Discussions

EJB design: problem in 2 phase commit

  1. problem in 2 phase commit (4 messages)

    i am using WSAD 5.0 and oracle 8.1.7. I am making statefull session bean. Statefull session bean calls method m1() of design pattern DAO object (dao1). In method m1() oracle connection is opened using jdbc driver record is inserted and connection is closed. After calling method m1(), stateful session bean calls another method m2() of another design pattern DAO object (dao2). In method m2() oracle connection is opened using jdbc driver, record is inserted and connection is closed. this oracle database is different from another. I want to make both insertions under one transaction without changing any of DAOs.

    if i use bean managed transaction and simple jdbc driver and usertransaction object then it gives me error

    [1/6/04 17:28:31:322 GMT+05:30] 273978f2 TransactionIm E WTRN0062E: An illegal attempt to use multiple resources that have only one-phase capability has occurred within a global transaction.

    if i use bean managed transaction and XA jdbc driver and usertransaction object then it gives me some error at the time of starting WSAD test server that XAResource not availbale.

    Please help me out

    Threaded Messages (4)

  2. problem in 2 phase commit[ Go to top ]

    You will have to obtain the connection via the container (using JNDI data source lookup) and only such a connection will give you 2PC ! I guess I understood the issue properly. Without this, you will get the error for sure.

    -Sanjay
  3. problem in 2 phase commit[ Go to top ]

    i am already taking connection from connection pool through jndi. is there any restriction on using classes12.zip of oracle 8.1.7. This i am thinking because when i specify driver as XA driver then at the time of starting test server, it gives me error Can not use XA resource.
  4. problem in 2 phase commit[ Go to top ]

    XAResource is the only type that can perform 2PC. see https://www.theserverside.com/home/thread.jsp?thread_id=23151 .

    Check if you have licensing for 2PC.

    Mike
  5. problem in 2 phase commit[ Go to top ]

    This is transaction across databases so you'll have to use xa jdbc drivers.
    Also, connection needs be taken through container(data source).

    One more option:
    Your transaction is across Oracle databases. Oracle provides a facility called link for access of different database(oracle) from a single database.
    Link takes care of two phase commit.

    This way you can avoid use of xa driver.

    Thanks,
    Badrish