Explicit Transaction does not work

Hi,

We are using IS6.5. When I try to use explicit transaction, I get following error. I try to reboot the IS but it does not help. When I comment out the explicit transaction, all adapter services work fine. I do not use the debug mod. The error is from server log. I assign same transaction name to startTransaction, commitTransaction and rollbackTransaction

[ART.117.4002] Adapter Runtime (Adapter Service): Unable to invoke adapter service DFJDEPurchaseOrder.Adapters:insertF47011.
[ART.117.4011] Adapter Runtime (Adapter Service): Unable to connect to resource DF_Connections:ERP8JDBC. The resource is already being used in a parent transaction.

My explicit transaction is defined as below.

start transaction
sequence (exit on success)
sequence (exit on failure)
callAdapterService
commit transaction
sequence (exit on done)
rollback transaction

Thank

Try this!

sequence (exit on success)

  • sequence (exit on failure)
    – start transaction
    – callAdapterService
    – commit transaction
  • sequence (exit on done)
    – rollback transaction

At first, I used the startTransaction just before the adapter service call. It did not work. Then I read through the JDBC user guid for explicit transaction, there recommand to take the startTransaction out of sequence. (JDBC Adapter User s Guide Version 6.5 page 228)It does not work either.

Check your adapter connection properties; Are you using LOCAL_TRANSACTION connection?

Yes, my adapter services all using same LOCAL_TRANSACTION connection.

“The resource is already being used in a parent transaction.”

This indicates that somewhere in the FLOW execution you have already started a transaction, probably an implicit one. Is the service in which you’re calling startTransaction being called from another service? Do any of the services up the service call stack have a JDBC service being called? If so, that’s why the explicit transaction is failing–a transaction has already been started (as the error message indicates).

Yes, the service starts transaction explicity called by the other service. I look through other services but have not found anything yet. I created a SR to webMethods. They are helping me looking through the issue now. When I get answer, I will post here.

Does that the calling service have a JDBC service call of any sort in it? For example:

Service A
–MAP this
–MAP that
–INVOKE someJDBCService
–INVOKE Service B

Service B
– INVOKE startTransaction
– INVOKE someOtherJDBCService
– INVOKE commitTransaction

If this is the structure, the startTransaction in Service B will always fail because there is an implicit transaction already started by Service A. The transaction in Service A will not be committed/rolledback until A exits with success/failure.

The solution: use an explicit transaction in Service A. If the activity in A is independent of B, commit before invoking B. If B is to be part of the A transaction, then you can nest the transactions.

Refer to Appendix B of the JDBC Adapter User’s Guide for transaction management info.

Yes, you are right. After I make explicit transaction for other adapter services, the problem is solved.

I appreciate your help!

@raemon

I wish to nest explicit transactions, and here is what I am trying to do:

Service A
–INVOKE startTransaction
–INVOKE someJDBCService
–INVOKE Service B
–INVOKE commitTransaction

Service B
– INVOKE startTransaction
– INVOKE someOtherJDBCService
– INVOKE commitTransaction

Both my JDBC services use the same adapter connection (LOCAL_CONNECTION)
Trying to execute this flow gives me the error “The resource is already being used in a parent transaction.”

Any help would be greatly appreciated.

Hello,

If you are trying to initiate two transactions (nested transactions) using different adapter services which uses same JDBC connection, then you need to know that two transactions cannot be initiated on same JDBC connection. Hence the error “The resource is already being used in a parent transaction” because a transaction is already active and you are trying to initiate another transation on same resource. Hope now it is clear.

Regards,
Vishnu