Handling consistency when making synchronous calls between two disjoint databases
I've recently come across a problem related to a project in which I have a setup consisting of  1-to-many data repositories (being either database, web-service etc., however to keep things more 'simple' lets just assume they are all databases) as well as a single application which needs to fetch data from these. 

**The problem:** So, let's assume that the main application which needs to retrieve these data can get a fraction of the data as a whole from both repository A and repository B, - Furthermore, the data from B depend on data from A. A possible flow would be to the application first fetch data from repository A and then query repository B for the remaining data based on the data from the first query to A. 

I've currently solved the problem with retrieval of the data, so this is not my problem. However, the problem I need to solve is how I can ensure that data are kept consistent during the entire transaction of all the databases I need to retrieve data from. 

As an example, suppose I have two databases, each containing parts of a customers information. The first database may contain the name, address and phone for a customer, whereas the another database may contain the email of that specific customer. When querying for customer data as a whole I need both parts, but I want to be sure that during the retrieval of the data, the data I am going to retrieve must not change in the rows I get back from the databases.

So what I am looking for is either some good guidelines for how this may be achieved, and/or some practical knowledge on this problem.

Kind regards,
E





Handling consistency when making synchronous calls between two disjoint databases
===

I've recently come across a problem related to a project in which I have a setup consisting of  1-to-many data repositories (being either database, web-service etc., however to keep things more 'simple' lets just assume they are all databases) as well as a single application which needs to fetch data from these. 

**The problem:** So, let's assume that the main application which needs to retrieve these data can get a fraction of the data as a whole from both repository A and repository B, - Furthermore, the data from B depend on data from A. A possible flow would be to the application first fetch data from repository A and then query repository B for the remaining data based on the data from the first query to A. 

I've currently solved the problem with retrieval of the data, so this is not my problem. However, the problem I need to solve is how I can ensure that data are kept consistent during the entire transaction of all the databases I need to retrieve data from. 

As an example, suppose I have two databases, each containing parts of a customers information. The first database may contain the name, address and phone for a customer, whereas the another database may contain the email of that specific customer. When querying for customer data as a whole I need both parts, but I want to be sure that during the retrieval of the data, the data I am going to retrieve must not change in the rows I get back from the databases.

So what I am looking for is either some good guidelines for how this may be achieved, and/or some practical knowledge on this problem.

Kind regards,
E




