Altova MapForce 2023 Enterprise Edition

Databases as Global Resources

Home Prev Top Next

This topic explains how to use databases as global resources. There are situations in which you may need to map data from databases with the same structure but different data. Using a database resource will allow you to switch between databases without editing your mapping. To achieve this, we need to create a database alias with two configurations:


1.The Default configuration will point to the DevelopmentDatabase: MapForceExamples\Altova.sqlite.

2.The ReleaseDatabase configuration will point to Tutorial\Altova.sqlite.


To create and configure the database alias, take the steps below.


Step 1: Create a global resource

The fist step is to create a database alias. Take the steps bellow:


1.Click the ic-globrec toolbar button (Manage Global Resource). Alternatively, go to the Tools menu and click Global Resources.

2.Click Add | Database and enter a descriptive name in the Resource alias text box. In this example, we call the default configuration DevelopmentDatabase.

3.Click Choose Database, select SQLite, and browse for MapForceExamples\Altova.sqlite.

4.Click glob-addic and name the second configuration ReleaseDatabase.

5.Click Choose Database, select SQLite, and browse for Tutorial\Altova.sqlite.


Step 2: Use the global resource in the mapping

The next step is to configure the mapping so that it can use the database alias:


1.Open the Tutorial\PersonDB.mfd mapping.

2.Double-click the database component to open the Component Settings dialog box. Click Change.

3.Select Global Resources in the Select a Database dialog box and select the DevelopmentDatabase alias. Click Connect.

4.When you are prompted to select database objects, leave the default selection as is and click OK.


The connectivity parameters can be changed by clicking the ic-globrec toolbar button.


Step 3: Run the mapping with the desired configuration

You can now easily switch between the databases before running the mapping:


To use the DevelopmentDatabase configuration, select the menu item Tools | Active Configuration | Default.

To use the ReleaseDatabase configuration, select the menu item Tools | Active Configuration | ReleaseDatabase.


Alternatively, select the required configuration from the Global Resources drop-down list (see screenshot below).


When you switch between configurations, the Configuration switch dialog box informs you that the resource has been modified. Click Reload.


Note:The databases used in this example contain the same data. Therefore, there are no differences in the generated output.


© 2017-2023 Altova GmbH