setAutoCommit() on connection obtained from a XA data source in WebSphere Application Server throws an exception

Technote (FAQ)
Problem
SetAutoCommit() on a connection obtained from a XA Data Source in WebSphere® Application Server returns an exception. An example exception for Oracle is:
java.sql.SQLException: Use explicit XA call. For DB2® an example exception is: CLI0126E Operation invalid at this time.
Cause
The application gets the connection from a XA data source, the method setAutoCommit() on the connection can be set if only one resource is involved in the transaction. However, if more than one resource is involved in the transaction, it is not permitted. The JDBC™ drivers may give an exception when autocommit is set on the connection.
Solution
Add an explicit commit() to the application code.











Document Information

Product categories: Software, Application Servers, Distributed Application & Web Servers, WebSphere Application Server, Java 2 Connectivity (J2C)
Operating system(s): AIX, HPUX, Linux, Multi-Platform, Solaris, Windows
Software version: 3.5, 4.0, 5.0, 5.1, 6.0
Software edition: Edition Independent
Reference #: 1170234
IBM Group: Software Group
Modified date: 2004-05-27