Search in sources :

Example 11 with DruidXADataSource

use of com.alibaba.druid.pool.xa.DruidXADataSource in project seata by seata.

the class XAModeTest2 method testXADataSourceNormal.

@Test
@Disabled
public void testXADataSourceNormal() throws Throwable {
    DruidXADataSource druidDataSource = new DruidXADataSource();
    druidDataSource.setUrl(oracle_jdbcUrl);
    druidDataSource.setUsername(oracle_username);
    druidDataSource.setPassword(oracle_password);
    druidDataSource.setDriverClassName(oracle_driverClassName);
    XAConnection xaConnection = druidDataSource.getXAConnection();
    XAResource xaResource = xaConnection.getXAResource();
    Xid xid = XAXidBuilder.build("127.0.0.1:8091:1234", 1235L);
    // Since issue of Druid(https://github.com/alibaba/druid/issues/3707), XA start will fail.
    xaResource.start(xid, XAResource.TMNOFLAGS);
}
Also used : XAResource(javax.transaction.xa.XAResource) Xid(javax.transaction.xa.Xid) XAXid(io.seata.rm.datasource.xa.XAXid) DruidXADataSource(com.alibaba.druid.pool.xa.DruidXADataSource) XAConnection(javax.sql.XAConnection) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Aggregations

DruidXADataSource (com.alibaba.druid.pool.xa.DruidXADataSource)11 AtomikosDataSourceBean (org.springframework.boot.jta.atomikos.AtomikosDataSourceBean)3 SqlSessionFactoryBean (org.mybatis.spring.SqlSessionFactoryBean)2 Bean (org.springframework.context.annotation.Bean)2 JdbcDataSource (io.mycat.datasource.jdbc.datasource.JdbcDataSource)1 DataSourceProxyXA (io.seata.rm.datasource.xa.DataSourceProxyXA)1 XAXid (io.seata.rm.datasource.xa.XAXid)1 XAConnection (javax.sql.XAConnection)1 XAResource (javax.transaction.xa.XAResource)1 Xid (javax.transaction.xa.Xid)1 Disabled (org.junit.jupiter.api.Disabled)1 Test (org.junit.jupiter.api.Test)1 Primary (org.springframework.context.annotation.Primary)1