-
Jan 29th, 2013, 05:32 PM
#1
Multiple Datasources/Database in one spring transaction
Hello Experts,
I'm a newbie to the spring world and would need youe expert advise on one of my situation today. I'm working on a core java batch program and I've an operation which executes a db insert/update to an oracle database as well as a sybase database. I want both these calls to be in one single transaction.
Intially I had only one DS and I managed as below :
<tx:annotation-driven transaction-manager="txManager" />
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
<property name="dataSource" ref="oracleDataSource" />
</bean>
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED, readOnly = false)
public boolean executeServices(){
.........
.....
}
For Oracle I'm using OracleConnectionPoolDataSource & for sybase I'm using JtdsDataSource. Any help will be much appreciated.
Last edited by itsmeanand; Jan 29th, 2013 at 05:52 PM.
-
Jan 29th, 2013, 07:09 PM
#2
You would need a JTATransactionManager to support two phase XA commits. Other transaction managers can only manage one transactional resource, like in your case just one db in a single transaction.
Mark
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules