The resource is already being used in a parent transaction.

Although there are already many topics with the same issue, my problem is a bit diferent…it is not nested transactions…but 2 diferent serial transactions.

I have a Flow that:


2.1 StartTransaction A
2.2 InsertRecordIntoDB
2.3 CommitTransaction A
3.1 RollBackTransaction A

outside try-catch (2-3)

6.1 StartTransaction B
6.2 LockRecord (updates fields in DB)
6.3 CommitTransaction B
7.1 RollBackTransaction B

2.2 occurs normally
4 also works ok
6.2 does not work returning the error:
Unable to invoke adapter service from 6.2.
[ART.117.4011] Adapter Runtime (Adapter Service): Unable to connect to resource XXXXXX The resource is already being used in a parent transaction.

Cant seem to figure out the problem…
Already read several posts with similiar problems…

Your problem is with getIDfromInsertedRecord. Assuming that this step uses the same adapter connection used by LockRecord (updates fields in DB), when the IS reaches getIDfromInsertedRecord and realizes that it is not within an explicit transaction, it will start an implicit transaction for it. When you reach LockRecord, the IS realizes that LockRecord is within an explicit transaction, but an implicit transaction has already been started on that same connection so you get the error you’re seeing.

You have some choices depending on your requirements. For example:

  1. Create a separate connection and set it to NO_TRANSACTION. Use this connection for your read-only operations like getIDfromInsertedRecord and use your existing LOCAL_TRANSACTION connection for your read-write stuff.

  2. Move getIDfromInsertedRecord into one of the existing explicit transactions (i.e. within the startTransaction - commitTransaction block)

  3. Remove the explicit transactions and let the IS handle the commit/rollback with an implicit transaction.

  • Percio

The issue was actually in the 6.2 LockRecord (updates fields in DB)
This service locks a record if the lock is empty or expired. to know this it uses a selectAdapterService that uses a NO_TRANSACTION connection.

I could have changed the selectServices to use the same connection, but I opted to pass the LOCAL_TRANSACTION connection to the adapterService and It works.


But not everything works…and I have no clue why. I have read several posts and it looks like I am doing everything right…

1-StartTransaction and store transactionName in a variable.

2.1 Sequence to updateRecord
2.2 Sequence to removeFields from Table
2.3 Sequence to insertFields into Table
2.4 Commit Transaction (transactionName)

3.1 RollBackTransaction (transactionName)

If I run step-by-step everything works fine (2.1, 2.2, 2.3) until I reach the commit.

If I run it normally it tries 2.1 and does not execute it returning the following error:
[ART.117.4011] Adapter Runtime (Adapter Service): Unable to connect to resource myConnection. The resource is already being used in a parent transaction.


Stepping through adapter services doesn’t quite work as you’d expect. The reason is because of the way the Integration Server maintains the transactions at the context level. In a nutshell, when you step through a service, you’re initiating a new context each time, whereas when you run it, it’s a single context.

If you’d like, attach your package so we can take a look at the code. It may be easier to find out what’s wrong that way.

  • Percio