A Global Resource is a reusable reference that represents a file or folder path, or a database connection. Global Resources are defined only once and can be reused as many times as necessary in contexts which support them, including across multiple Altova applications. Taking databases as example, if you frequently work with a specific database in more than one Altova application, then it is a good idea to add the database connection as a Global Resource. This way, you wouldn't need to go through all the Database Connection Wizard steps each time when you need to connect to the same database from another Altova application.
Each Global Resource can have so-called "configurations". Configurations make it possible to easily switch between files, folders and databases that are consumed or produced by Altova applications, which is particularly useful for testing scenarios. For example, you could create a database resource that consists of three separate connections to the same database, each with a different driver kind: (a) ODBC, the default connection kind, (b) JDBC, and (c) ADO.NET. This way, to connect to the database with a specific driver, you would just select the corresponding configuration from the Global Resources drop-down list.
Global Resources drop-down list
Configurations can also help you generate mapping output to variable folders, with a click of a button. For example, you could create a folder resource with two configurations: (a) "Testing", which points to directory C:\Testing and (b) "Production", which points to directory C:\Production. It is then possible to configure a mapping to generate output to either C:\Testing or C:\Production folders, just by selecting the required configuration from the Global Resources drop-down list before running the mapping. This example is discussed in more detail in Example: Generate Output to Variable Folders.
To create a Global Resource:
1.On the Tools menu, click Global Resources. (Alternatively, click the Manage Global Resources toolbar button.)
2.Click Add and select the resource type you wish to create (file, folder, database).
3.Enter a descriptive name in the Resource alias text box (for example, "InputFile", "OutputFolder", "DatabaseConnection").
4.Set up the "Default" configuration:
a) If it's a file or folder, browse for the file or folder to which this resource should point by default.
b) If it's a database connection, click Choose Database and follow the Database Connection Wizard to connect to the database (see Connecting to a Database). This database connection will be used by default when the mapping runs (unless a different configuration is explicitly selected from the Global Resources drop-down list or supplied as a command line parameter in server execution).
5.Optionally, if the resource should have an additional configuration (for example, a driver kind in case of databases, or an alternative path in case of files or folders), click the Add configuration button, enter a descriptive name (for example "ProductionFolder" or "JDBC_Alternative"), and set it up as follows:
a) If it's a file or folder, browse for the file or folder to which this resource should point as an alternative to the default configuration defined in previous step.
b) If it's a database connection, follow the Database Connection Wizard to connect to the database. This database connection will be used as an alternative to the default one.
In some cases, it might be more convenient to create a configuration as a copy of the default configuration, and then edit it. In this case, click the Add configuration as a copy of the currently selected configuration button.
6.Repeat the previous step for each additional configuration required.