Atomikos Forum

how can i configure XA capable data source using mysql

Hi
  We planned to implement  a application using spring 3.0.2 and hibernate jpa 2.0 and for getting xa transaction support we are using Atomikos 3.6.4,and  our back end is mysql 5.5.MySQL has some limitations with XA transactions as you can see (http://dev.mysql.com/doc/refman/5.0/en/xa-restrictions.html), Because of using mysql 5.5,we could not get xa transaction(rollback not happening) properly,it does not support transaction .but in same configuration when i try with non xa transaction with atomickos ,transaction management is working fine .Is there is any other way to acheive xa transaction with atomikos using mysql.
 
My non XA  data source from Atomikos.
  Inside meta-inf/context.xml
 
  <Transaction factory="com.atomikos.icatch.jta.UserTransactionFactory" />
          <Resource name="jdbc/myDataSource" auth="Container"
          factory="org.apache.naming.factory.BeanFactory"
          type="com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean"
          uniqueResourceName="myMySqlDatabase" driverClassName="com.mysql.jdbc.Driver"                url="jdbc:mysql://localhost:3306/testdb" user="root" password="root" maxPoolSize="20" reapTimeout="300" />
         
My XA data source from Atomikos.
 Inside meta-inf/context.xml
<Transaction factory="com.atomikos.icatch.jta.UserTransactionFactory" />
  <Resource name="/myDataSource" auth="Container"
        driverClassName="com.mysql.jdbc.Driver" user="root" password="root"
        autoCommit="false"
        type="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"
        factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"
        url="jdbc:mysql://localhost:3306/testdb" explicitUrl="true"
        pinGlobalTxToPhysicalConnection="true"> </Resource>
        
         thanks in advance
daya Send private email
Thursday, December 23, 2010
 
 
Atomikos does fine with XA and MySql - yes there are some restrictions like you found at the docs - but most tx managers or tx scenarios can deal with that missing feature - at least spring managed tx does :-D.

Here is some "working" configuration (its spring configured but you can port this to tomcats jndi resource stuff):

  <bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close">
    <property name="uniqueResourceName" value="${dataSource.uniqueName}" />
    <property name="maxPoolSize" value="${connection.pool.maxPoolSize}" />
    <property name="minPoolSize" value="${connection.pool.minPoolSize}" />
    <property name="maxIdleTime" value="${connection.pool.lifetime}" />
    <property name="maintenanceInterval" value="${connection.pool.reaperDelay}" />
    <property name="reapTimeout" value="${connection.pool.timeout}" />
    <property name="testQuery" value="${connection.pool.validationStatement}" />
    <property name="xaDataSource" ref="mysqlDS" />
  </bean>
 
  <bean id="mysqlDS" class="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" lazy-init="true">
    <property name="pinGlobalTxToPhysicalConnection" value="true" />
    <property name="user" value="${dataSource.DB_USER}" />
    <property name="password" value="${dataSource.DB_PASSWORD}" />
    <property name="URL" value="${dataSource.DB_URL}" />
  </bean>
Torsten Krah Send private email
Tuesday, December 28, 2010
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics