Integrate Multiple Databases

Integrate Multiple Databases
lac40
You can integrate multiple databases as part of your API. You can define relationships, resources, and build rules between databases.
If you have built rules between databases, each database commits separately. One database may succeed while the other fails.
For more information about how to define relationships between databases, see Manage Relationships.
In this article:
2
Define Resources Between Databases
You can define resources that combine data from different databases. The resource's join condition defines how this resource is joined with the containing resource.
CA Live API Creator
 efficiently optimizes resources that combine data from different databases. For example, 
CA Live API Creator
 retrieves customers and then retrieves the 
OrdersFromSample
 rows.
  1. With your API open, in the Create section, click
    Resources
    .
    The Resource tab displays by default.
  2. Enter syntax in the 
    Join
     field and then save your changes. For example:
    "customer_name" = [name]
     Defining the relationship between the databases defaults the join and the key appears as the value in the 
    Join
     field. You can change this value.
    The following image shows this field on the tab:
    Screen Shot 2015-10-23 at 12.40.07 PM.png
The resources between databases are defined.
Refer to Columns in a Table of the Containing Resource
Use the following notation in the
Join
field:
customer_number = [custnum] and region_ident = [regident]
In this example,
customer_number
and
region_ident
are columns of the current resource's table, and
custnum
and
regident
are columns of the table for the containing resource.
MongoDB Resource Syntax
If you are joining MongoDB collections, use Mongo syntax in the
Join
field.
 For more information about how to join MongoDB collections, see Define MongoDB Resource Types.
Rename Data Source Prefixes
 Renaming a data source prefix breaks rules and resource definitions.
For more information about data source prefix names, see Database Connectivity.
  1. Export your API.
  2. Change the data source prefix in a text editor.
  3. Import your API.
APIs for Database Access
You can use the same APIs to interact with data, whether your API interacts with data in a single database or in multiple databases.
For more information about how to use the same APIs to interact with data in multiple databases, see The logicContext Object.