Yes, this is definitely possible: just use the JtaTransactionManager, since you'll be needing 2 phase commit support. Also make sure that you use the XA-capable version of the DB2 drivers.
This is assuming that you do not need transaction suspension support (PROPAGATION_REQUIRES_NEW / PROPAGATION_NOT_SUPPORTED). If you do, then you'll also need to configure a WebSphereTransactionManagerFactoryBean for the JtaTransactionManager, assuming you're using Spring 2.0.
If you are already using a Spring 2.1 milestone, be sure to use the new WebSphereUowTransactionManager instead of the regular JtaTransactionManager: this allows full integration with WebSphere's transaction manager in an IBM-supported fashion.
OTOH, you're posting in the EJB-forum, so are you using Spring's transaction support or EJB CMT? If Spring's tx mgt, then I suggest that you use the Data Access forum instead to pose these sort of questions; your chances of getting an answer are greater there. If you're using EJB CMT, then please be aware of the fact that you can't look up the UserTransaction inside of a CMT transaction in WebSphere: therefore, you'll need to tell Spring not to try, like this:
Code:
<!-- This transaction manager will cooperate with the CMT-initiated JTA transactions -->
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<!-- Since we participate in a CMT transaction, we may not look up the UserTransaction; see the following page for an explanaton:
http://publib.boulder.ibm.com/infocenter/wasinfo/v5r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/cjta_glotran.html
-->
<property name="userTransactionName"><null /></property>
</bean>
If you're also using a WebSphereTransactionManager, set the transactionManager property of the JtaTransactionManager by refering to it or declaring it as an inline bean:
Code:
...
<property name="transactionManager" ref="wasTransactionManager"/>
</bean>
<bean id="wasTransactionManager" class="org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean"/>