Best combination of using 2 adapter services in the same flow service

Hi,

If I have a situation to use two adapter services ( which connect to same DB )in the same flow service which combination should we use like
both Local or
both No or
one Local one NO.

Kindly let me know with reasons.

Thanks,
RP.

Since single db is involved use local transaction connection.

Are you preparing for some interviews :slight_smile:

Out of two, one adapter service uses select query and the other uses update query. I am getting Runtime error saying ‘Error(s) occurred while closing adapter connections’.

Thanks,
RP.

Make sure the start, commit and rollback transaction are handled correctly. Share your code screen shots and detailed error. See you back soon.

Though we keep start, commit, rollback in a perfect way, if we use two no transactions in the same flow service then we will get ‘issue with closing connections error’. I know the reason which is exist in some document which I don’t rememeber now, You don’t bother about this, let me know if you know the combination and its result.

Thanks,
RP.

I only know JDBC adapter guide I am not sure to which document you are referring to, share me the document if you find it.

When in doubt, stick with LOCAL. It covers the majority of use cases. The error you’re referring to is fairly well known. Simply search the forums and you should find a few threads about it. Here’s one from 2009:

Percio

Humm, thanks for sharing. I did a few changes now not seeing this error.

Thanks,
Anil.

Thanks Percio for your comments. I gone through thread and tried to do changes. But still facing error occasionally.

Thanks,
RP.

sorry for updating wrong thread :roll: Going to vacation so a little excited.

As long as there is no explicit transaction handling required, all can be done with NO_TRANSACTION.

As soon as explicit transaction handling is required, the Select still can run on NO_TRANSACTION.
For the Update/Insert and so on you will use LOCAL_TRANSACTION.

Remember to place the Transaction services (start, commit, rollback) at the right places in your code.

Keep in mind that flow service which contain transactional adapter services can not be debugged step by step.
This will cause the transactions to fail.
See Developers/Designers User Guide or the community forums for details.

Regards,
Holger

Yes, but be careful with NO_TRANSACTION connections with operations that change the data (i.e. CRUD). NO_TRANSACTION is basically equivalent to an auto-commit. So, suppose you have a Flow service with a couple of adapter service calls that use the same connection and it uses an implicit transaction (i.e. there are no calls to start/commit/rollback):

someFolder:insertHeader
LOOP over /lineItems
someFolder:insertDetail

Now, suppose one of the calls to insertDetail fails and an exception gets thrown.

If your connection is set to LOCAL_TRANSACTION, the changes made by insertHeader and any previous insertDetail calls are automatically rolled back, which is typically the desired outcome. However, if your connection is set to NO_TRANSACTION, those changes are NOT rolled back, because like I said, they are auto-committed.

Just to be sure to fully understand the behavior of whatever path you choose to follow so you’re not caught by surprise later on. And as always, test thoroughly.

Percio

I agree with your comments Percio. Thanks,

RP,
You did not agree with my comments? Are you? :lol: