Executing Mappings Which Modify Databases

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Data Sources and Targets > Databases and MapForce > Introduction to Database Mappings >

Executing Mappings Which Modify Databases

When a mapping modifies database data in any way (for example, by inserting, updating, or deleting records), the changes are applied to the database by the engine that executes the mapping. The engine that executes the mapping can be MapForce, MapForce Server (both standalone or under FlowForce Server management), or the execution environment of the code generated for C++, C#, or Java.

 

When you preview the mapping result directly in MapForce (by clicking the Output tab), an update script is displayed. The script is not actually executed against the database until you take this action explicitly; it is available for preview only.

mf_db_script

Output preview of a mapping which modifies a database (Altova_Hierarchical_DB.mfd)

The script shows pseudo-SQL statements just for information purpose; it does not directly reflect the statements that are to be executed. For example, if multiple actions are defined against a table (such as "Update if... Insert Rest"), only the first action is shown in the preview, since the second action is executed conditionally.

 

The pseudo-SQL script must not be manually applied to the database using SQL tools other than the execution engines mentioned above. The script may contain formatting of values not "understood" by external SQL editors.

 

If you want to apply the mapping changes to the database directly from MapForce, click the Run SQL-Script command available in the Output menu. Remember that this action will actually modify the database with immediate effect.

 

When the mapping is executed with MapForce Server (both standalone or under FlowForce Server management), the changes to the database are applied with immediate effect. The same happens in the generated code: the database changes are applied when you compile and run the code (for example, by clicking the Run command in Visual Studio).

 

Your MapForce installation includes several example databases (Microsoft Access or SQLite files) available in the <Documents>\Altova\MapForce2019\MapForceExamples\ folder. It is advisable not to apply database changes from MapForce, using the Run SQL-Script command, against any of the example databases supplied with MapForce; this may render the examples unusable. A simple way to avoid overriding original data is to back up the entire <Documents>\Altova\MapForce2019\MapForceExamples\ folder before updating any files in it.

 

For information about running mappings in execution environments other than MapForce, see:

 

Deploying Mappings to FlowForce Server
Compiling Mappings to MapForce Server Execution Files
Code Generator

© 2019 Altova GmbH