Atomikos数据源配置方法有三种

http://kb.cnblogs.com/a/2012014/

Atomikos数据源配置方法有三种分别有:SimpleDataSourceBean,AtomikosDataSourceBean,AtomikosNonXADataSourceBean可任选一种

 
   
Simple表示基础数据库连接配置 < bean id ="oracleJta" class ="com.atomikos.jdbc.SimpleDataSourceBean" init-method ="init" destroy-method ="close" > < property name ="uniqueResourceName" > < value > OracleXADataSource value > property > < property name ="xaDataSourceClassName" > < value > oracle.jdbc.xa.client.OracleXADataSource value > property > < property name ="xaDataSourceProperties" > < value > URL=jdbc:oracle:thin:@localhost:1521:orcl;user=orcl;password= value > property > < property name ="exclusiveConnectionMode" > < value > true value > property > < property name ="connectionPoolSize" > < value > 3 value > property > < property name ="validatingQuery" > < value > SELECT 1 value > property > bean > Atomikos表示必须要用到XA数据库驱动类,可设置连接池(经过测试推荐此方法) < bean id ="oracleJta" class ="com.atomikos.jdbc.AtomikosDataSourceBean" init-method ="init" destroy-method ="close" lazy-init ="true" > < property name ="uniqueResourceName" > < value > OracleXADataSource value > property > < property name ="xaDataSourceClassName" > < value > oracle.jdbc.xa.client.OracleXADataSource value > property > < property name ="xaProperties" > < props > < prop key ="URL" > jdbc:oracle:thin:@localhost:1521:orcl prop > < prop key ="user" > orcl prop > < prop key ="password" > prop > props > property > < property name ="poolSize" >< value > 1 value > property > < property name ="maxPoolSize" >< value > 30 value > property > bean > AtomikosNon表示必须要用到普通数据库驱动类,可设置连接池 < bean id ="oracleJta" class ="com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean" > < property name ="uniqueResourceName" >< value > OracleXADataSource value > property > < property name ="user" >< value > orcl value > property > < property name ="password" >< value > value > property > < property name ="url" >< value > jdbc:oracle:thin:@192.168.1.217:1521:orcl value > property > < property name ="driverClassName" >< value > oracle.jdbc.OracleDriver value > property > < property name ="poolSize" >< value > 1 value > property > < property name ="borrowConnectionTimeout" >< value > 60 value > property > bean > 另外一个数据库在这就不在写了,设置同上只是mysql的驱动类名为:xaDataSourceClassName:com.mysql.jdbc.jdbc2.optional.MysqlXADataSource

3.事务配置

 
  
Atomikos事务方法 < bean id ="atomikosTransactionManager" class ="com.atomikos.icatch.jta.UserTransactionManager" init-method ="init" destroy-method ="close" > < property name ="forceShutdown" > < value > true value > property > bean > < bean id ="atomikosUserTransaction" class ="com.atomikos.icatch.jta.UserTransactionImp" > < property name ="transactionTimeout" value ="240" /> bean > < bean id ="transactionManager" class ="org.springframework.transaction.jta.JtaTransactionManager" > < property name ="transactionManager" > < ref bean ="atomikosTransactionManager" /> property > < property name ="userTransaction" > < ref bean ="atomikosUserTransaction" /> property > bean >

你可能感兴趣的:(架构设计,atomikos,多库事务)