use of com.alibaba.druid.pool.xa.DruidXADataSource in project warn-report by saaavsaaa.
the class DistributeTransaction method initXADataSource.
DruidXADataSource[] initXADataSource() {
System.out.print("Create a XADataSource_1 data source: ");
DruidXADataSource xaDataSource_1 = new DruidXADataSource();
xaDataSource_1.setDbType(props.getProperty("db1.dbtype"));
xaDataSource_1.setUrl(props.getProperty("db1.url"));
xaDataSource_1.setUsername(props.getProperty("db1.username"));
xaDataSource_1.setPassword(props.getProperty("db1.password"));
System.out.println("Okay.");
System.out.print("Create a XADataSource_2 data source: ");
DruidXADataSource xaDataSource_2 = new DruidXADataSource();
xaDataSource_2.setDbType(props.getProperty("db2.dbtype"));
xaDataSource_2.setUrl(props.getProperty("db2.url"));
xaDataSource_2.setUsername(props.getProperty("db2.username"));
xaDataSource_2.setPassword(props.getProperty("db2.password"));
System.out.println("Okay.");
return new DruidXADataSource[] { xaDataSource_1, xaDataSource_2 };
}
use of com.alibaba.druid.pool.xa.DruidXADataSource in project warn-report by saaavsaaa.
the class DistributeTransaction method initXADataSource.
DruidXADataSource[] initXADataSource() {
System.out.print("Create a XADataSource_1 data source: ");
DruidXADataSource xaDataSource_1 = new DruidXADataSource();
xaDataSource_1.setDbType(props.getProperty("db1.dbtype"));
xaDataSource_1.setUrl(props.getProperty("db1.url"));
xaDataSource_1.setUsername(props.getProperty("db1.username"));
xaDataSource_1.setPassword(props.getProperty("db1.password"));
System.out.println("Okay.");
System.out.print("Create a XADataSource_2 data source: ");
DruidXADataSource xaDataSource_2 = new DruidXADataSource();
xaDataSource_2.setDbType(props.getProperty("db2.dbtype"));
xaDataSource_2.setUrl(props.getProperty("db2.url"));
xaDataSource_2.setUsername(props.getProperty("db2.username"));
xaDataSource_2.setPassword(props.getProperty("db2.password"));
System.out.println("Okay.");
return new DruidXADataSource[] { xaDataSource_1, xaDataSource_2 };
}
use of com.alibaba.druid.pool.xa.DruidXADataSource in project mybatis.flying by limeng32.
the class DataSourceConfig method xaDataSource1.
public XADataSource xaDataSource1() {
DruidXADataSource xaDataSource = new DruidXADataSource();
xaDataSource.setUrl("jdbc:h2:mem:testdb;MODE=MySQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MV_STORE=FALSE;MVCC=FALSE;FILE_LOCK=NO");
xaDataSource.setUsername("sa1");
xaDataSource.setPassword("null");
return xaDataSource;
}
use of com.alibaba.druid.pool.xa.DruidXADataSource in project dynamic_dataSource by tianliuzhen.
the class MyBatisConfig1 method oneDataSource.
// 配置第一个数据源
@Primary
@Bean(name = "oneDataSource")
public DataSource oneDataSource() {
// 这里datasource要使用阿里的支持XA的DruidXADataSource
DruidXADataSource datasource = new DruidXADataSource();
BeanUtils.copyProperties(oneDataSourceProperties, datasource);
AtomikosDataSourceBean xaDataSource = new AtomikosDataSourceBean();
xaDataSource.setXaDataSource(datasource);
xaDataSource.setUniqueResourceName("oneDataSource");
return xaDataSource;
}
use of com.alibaba.druid.pool.xa.DruidXADataSource in project dynamic_dataSource by tianliuzhen.
the class MyBatisConfig2 method twoDataSource.
@Bean(name = "twoDataSource")
public DataSource twoDataSource() {
DruidXADataSource datasource = new DruidXADataSource();
BeanUtils.copyProperties(twoDataSourceProperties, datasource);
AtomikosDataSourceBean xaDataSource = new AtomikosDataSourceBean();
xaDataSource.setXaDataSource(datasource);
xaDataSource.setUniqueResourceName("twoDataSource");
return xaDataSource;
}
Aggregations