Would it be advisable to use a JDBC adapter defined as LOCAL_TRANSACTION as transaction type to be used to automatically commit transactions.
I need most of my transactions to the database need to be commited immediately. But I have a scenario where I need to explicitly commit or rollback.
Let me put it in detail.
>>> pub.art.transaction:startTransaction
>>>>>> adapterA.service1
>>>>>> adpaterB.service2
>>>>>> adapterA.service3
>>> pub.art.transaction:commitTransaction
On error case
>>> pub.art.transaction:rollbackTransaction
How would this work if ‘adpaterA’ is of transaction type ‘NO_TRANSACTION’ and ‘adapterB’ is configured for ‘LOCAL_TRANSACTION’.
Would it be advisable to convert adapterA to be of ‘LOCAL_TRANSACTION’ type without handling the ‘pub.art.transaction:startTransaction’ and ‘pub.art.transaction:commitTransaction’ part.
I am having 100’s of adapter services with ‘NO_TRANSACTION’, I do not want the pain to put a transaction around them.
I assume you’ve reviewed the “webMethods JDBC Adapter User’s Guide”, particularly Appendix B, which talks about the transaction types and implicit/explicit transactions. If you’re like me, you found yourself scratching your head wondering “if I use explicit transactions with a connection that is set for NO_TRANSACTION, what happens?”
The release notes state:
This implies that the adapter manages the transaction context of connections set to NO_TRANSACTION, regardless of if you call startTransaction or not–but it doesn’t come right out and say that. Urgg.
One thing that is clear, though, is that only one LOCAL_TRANSACTION connection can be used within a transaction context. So in your example with adapterA and adapterB, if they are both LOCAL_TRANSACTION connections it won’t work. One or both of them will need to be XA_TRANSACTION. I’ve no idea what will occur with NO_TRANSACTION though I suspect that it won’t work either as all the connections will try to use the same transaction context and without the connections being set to XA, it will fail.
As Mark points out, you should set it up and test scenarios.
You mentioned you have “100s of adapter services with ‘NO_TRANSACTION’”. I assume you meant 100s of adapter connections. But if you really meant 100s of services and you have only a few connections (relatively speaking) then changing the transaction type of the connections might not be that much of an effort?