46
Views
3
Comments
Is it possible to update multiple tables exposed by REST API in one transaction?
Question
Application Type
Reactive

(1) First, create an API for a table stored in DB2 using the API server application provided by CData.
At this time, create APIs for two types of tables, Table A and Table B.


(2) In my OutSystems application development, I use two tables (Table A and Table B) for which APIs have been created. In that app I want to make a function that can update two tables in one transaction.

So I have a question,In OutSystems, is it possible to update multiple tables connected using REST API in one transaction? (The API is created using CData's API Server)


I look forward to hearing from you. 

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

For me, it is unclear from your description if you are updating the entities in OutSystems or the tables in your IBM DB2 database. As you are asking this on an OutSystems forum and not an IBM DB2 forum, I assume you're asking about a  transaction on the OutSystems database.

If you are updating your entities with data from the IBM DB2 database, then you should call both APIs in one server action. 

This will ensure that the data in your OutSystems entities are processed in one transaction.

Regards,

Daniel 

2023-10-19 01-11-40
Nara Futa

Dear Mr. Daniel

Thank you for your reply. 

Sorry my explanation was confusing.
I want to update a table in IBM DB2 database.

So I'll try asking on the IBM DB2 forums as well.

We appreciate it. 

Futa, Nara

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Nara,

If the REST API methods would be part of OutSystems, then no, it would not be possible to do this. REST methods run in their own database transaction, so if you first call a method for entity A, that transaction is comitted and closed, then you call a method for entity B, which is then also comitted and closed. If an exception happens in method B, this will not affect the update of A.

Of course, like Daniël wrote, if the REST API is a DB2 API, I would assume that (since REST is supposed to be stateless) each method has its own transaction, but for all we know DB2 has some global transaction state that you need to explicitly commit or the like, in which case it works differently from how OS handles it. But you indeed need to ask the DB2 community, not us.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.