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
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 . 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.
You can easily convert any data source connection that appears in a DatabaseSpy project to a Global Resource. To do this, right-click the connection in the Project window, and select Convert to Global Resource from the context menu.
The data source is added to the The Global Resources XML File and hence available in all Altova applications. Note that the icon in the Project window changes to indicate that the data source connection is now a global resource.
When you right-click the Data Sources folder in the Project window, you also have the option to convert all data sources in the project to global resources.