• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Getting 2 phase commit exception with SQL server and DB2 datasources....

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am using 2 datasources. one for SQL server(XA datasource)and another for DB2(not an XA).

In the particular transaction, our code gets nearly 3 connections using getConnection of XA datasource and 2 connections using DB2 datasource. Getting the following exception when the transaction is about to commit: "An illegal attempt to commit a one phase capable resource with existing two phase capable resources has occurred." Is it required to close all connections before committing?

Could you pls help me out of this problem soon??? Thanks in advance.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

What does "nearly 3 connections" mean? 2? 3? Why does the code get more than one connection per datasource inside of a single transaction?

Is it required to close all connections before committing?


If a connection is closed, all pending transactions are rolled back - probably not what you want.

It sounds as if the code is trying to use an XA transaction with a non-XA capable datasource. Can the code get an XA-capable connection for DB2 as well?
 
See ya later boys, I think I'm in love. Oh wait, she's just a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic