Bug #17734 | XA-datasource | ||
---|---|---|---|
Submitted: | 27 Feb 2006 3:52 | Modified: | 31 Mar 2014 11:21 |
Reporter: | steve ni | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | 5.0.0-beta | OS: | Windows (WinXP) |
Assigned to: | Alexander Soklakov | CPU Architecture: | Any |
[27 Feb 2006 3:52]
steve ni
[27 Feb 2006 13:45]
Mark Matthews
Two things to try. First, please try the latest nightly snapshot build of 5.0 from http://downloads.mysql.com/snapshots.php#connector-j as it has some fixes for local transactions. Also make sure you've added <track-connection-by-tx/> to your <xa-datasource> configuration.
[27 Feb 2006 23:01]
steve ni
I downloaded latest connector:mysql-connector-java-5.0-nightly-20060227-bin.jar. I added <track-connection-by-tx/> as well. But my programs get same exception.
[28 Jun 2006 10:46]
Victor Pyankov
I have similar problem with XAER_OUTSIDE in JBOSS with latest JConnector. Look at this session: SET NAMES cp1251; SET character_set_results = NULL; SHOW VARIABLES; SHOW COLLATION; SET autocommit=1; SET sql_mode='STRICT_TRANS_TABLES'; SET autocommit=0; SHOW VARIABLES LIKE 'tx_isolation'; >>> We get connection from pool >>> in EJB method with TransactionAttributeType.NOT_SUPPORTED SELECT 'Some sql statement'; >>> We put connection to pool >>> We get connection from pool >>> in EJB method with TransactionAttributeType.REQUIRES_NEW XA START 0x6f64696e2f3338,0x31,0x101; -> XAER_OUTSIDE ERROR ... Documentation say: “Within the context of a given client connection, XA transactions and local (non-XA) transactions are mutually exclusive. For example, if XA START has been issued to begin an XA transaction, a local transaction cannot be started until the XA transaction has been committed or rolled back. Conversely, if a local transaction has been started with START TRANSACTION, no XA statements can be used until the transaction has been committed or rolled back.” I can fix situation by hands. For example: SET NAMES cp1251; SET character_set_results = NULL; SHOW VARIABLES; SHOW COLLATION; SET autocommit=1; SET sql_mode='STRICT_TRANS_TABLES'; SET autocommit=0; SHOW VARIABLES LIKE 'tx_isolation'; SELECT 'Some sql statement'; COMMIT; <- Commit implicit transaction XA START 0x6f64696e2f3338,0x31,0x101; <- OK XA END 0x6f64696e2f3338,0x31,0x101; <- OK XA COMMIT 0x6f64696e2f3338,0x31,0x101 ONE PHASE; <- OK ... But what can I do under Jboss?
[29 Jun 2006 4:22]
Victor Pyankov
XAER_OUTSIDE exception has been eliminated in my case by "no-tx-separate-pools" addition to -ds.xml (see JBoss documentation)
[28 Aug 2006 13:44]
Felipe Leme
Hi Victor, I'm facing a similar issue, but in my case I think the error is been caused by the way Spring is configured, i.e. it is not properly starting the XA transaction. So, I have a question for you: how do you set mysql (or Connector/J) to log the session? TIA, -- Felipe
[29 Aug 2006 4:45]
Victor Pyankov
I use MySQL log (file or general_log table in 5.1.11) filtered by session ID.
[22 Oct 2006 8:30]
Valeriy Kravchuk
Please, try to repeat with a newer version of Connector/J, 5.0.4, and inform about the results.
[23 Nov 2006 0:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[6 Dec 2006 9:01]
Tony Xu
In jboss4.0+, you need these three parameters to avoid the annoying XAER_OUTSIDE. <track-connection-by-tx>true</track-connection-by-tx> <new-connection-sql>set autocommit=1</new-connection-sql> <no-tx-separate-pools>true</no-tx-separate-pools> By default, MySQL automatically sets autocommit to 0 when you create a new connection through MySQLXADataSource, new-connection-sql fixes it. If no-tx-separate-pools exists, connections not involved in any global transaction will be kept in a separate pool, thus XAER_OUTSIDE will disappear. Good luck!
[31 Mar 2014 11:21]
Alexander Soklakov
I close this report as "Can't repeat" because a workaround was provided, there is no feedback for a long time and codebase is too old. Please, feel free to reopen it if the problem still exists in current driver.