Atomikos Forum |
|
Hello,
Atomikos 3.8.0, MySQL 5.1.22, Spring 3.2.0 I have followed the Atomikos Spring example for configs so will not include the userTransactionService, atomikosTransactionManager, atomikosUserTransaction settings. I have for the jtaTransactionManager: <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager" depends-on="userTransactionService"> <property name="transactionManager" ref="atomikosTransactionManager" /> <property name="userTransaction" ref="atomikosUserTransaction" /> <property name="allowCustomIsolationLevels" value="true" /> </bean> I have a batch entry (Spring Batch records progress in a db table) <util:properties id="batchDbProperties" location="classpath:/META-INF/k12batchdb.properties" /> <bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close" depends-on="setMyAtomikosSystemProps"> <property name="uniqueResourceName" value="dataSource" /> <property name="xaDataSourceClassName" value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" /> <property name="xaProperties" ref="batchDbProperties" /> <property name="minPoolSize" value="10" /> <property name="maxPoolSize" value="20" /> <property name="borrowConnectionTimeout" value="30" /> <property name="testQuery" value="select 1" /> <property name="maintenanceInterval" value="60" /> </bean> A database for inserting files: <util:properties id="uymDbProperties" location="classpath:/META-INF/k12batchdb.properties" /> <bean id="uymDS" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close" depends-on="setMyAtomikosSystemProps"> <property name="uniqueResourceName" value="uymDS" /> <property name="xaDataSourceClassName" value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" /> <property name="xaProperties" ref="uymDbProperties" /> <property name="minPoolSize" value="10" /> <property name="maxPoolSize" value="20" /> <property name="borrowConnectionTimeout" value="30" /> <property name="testQuery" value="select 1" /> <property name="maintenanceInterval" value="60" /> </bean> The JdbcTemplate datasource is uymDS. So I believe I am correct in stating the atomikos datasource bean is tied correctly and should open / close correctly. As each file is read in the file name determines which database to connect to (something I don't know ahead of time). I determine it and then want to reset the atomikos ds bean to it. Currently, I am hardcoding in the DAO insertRecord method AtomikosDataSourceBean ds = (AtomikosDataSourceBean) getDataSource(); Properties xa = ds.getXaProperties(); xa.setProperty("url", "jdbc:mysql://xxx.xxx.xxx.xxx:3306/db_name?zeroDateTimeBehavior=convertToNull"); ds.setXaProperties(xa); ds.init(); When I check the url - it is displaying the new url. However the data is not being inserted into the correct database which makes me suspect ds bean or JtaTransactionManager or AtomikosTransactionManager... I tried ds.close() and ds.init() - no difference. If someone could point me at the 'guilty party(s)' to dig further I would be grateful - just not sure which is at fault. (I am sure I am at fault ;-)) Thanks |