Resolving identifiers
XML data to be loaded into a target database must contain identifiers for XML elements that require them. To generate or locate identifiers for catalog entities in the XML document, invoke the idresgen utility.
- Create an XML file describing the data using either of the following ID resolution methods:
- Use internal-alias ID resolution
- When using internal-alias resolution, an alias is substituted in place of the primary key (identifier) in the XML document. This alias is then used elsewhere in the XML file to refer to that element. This eliminates the need to know the unique indexes necessary to build the XML file.
Internal aliases must be used consistently throughout the file. If an address-book ID ADDRBOOK_ID is aliased to @addrbook_1, all foreign-key references to that ID in the file must use @addrbook_1. Note that aliases are transient. They are not saved; and they cannot be used in a separate XML file without introducing the aliases again.
- Use unique-index ID resolution
- Unique-index resolution, the default behavior of the idresgen utility, is used when there is no entry in the properties file for the table being analyzed or when there is no properties file. Unique-index resolution uses any of the specified unique indexes on a table as a means of locating the identifier.
To update the contents of the database, know the unique key from the primary table in the database. You can query your database to find this out. For example, a DB2 command for retrieving a unique key can look like the following:
- db2 describe indexes for table schema.tablename show detail
- Configure the idresgen utility.
- If necessary, add table names to the SUBKEYS table. For example, a DB2 command for creating an entry in the SUBKEYS table will look similar to the following:
db2 insert into SUBKEYS Values (-1, 'mytable', 'mytable_primary_key',10000,50,0,2147483647)The idresgen utility only resolves identifiers for a primary table. A primary table is one that is listed in the
KEYS or
SUBKEYS table. If it is necessary to resolve identifiers for a table that is not in KEYS or SUBKEYS, add the table to the SUBKEYS table before running the idresgen utility.- Select an appropriate method to resolve entities.
- Use the load method to process the input file if all records in the file do not exist in the database.
- Use the update method to process the input file if all records in the file exist in the database.
- Use the mixed method to process the input file if only some records in the file exist in the database.
- Run idresgen utility.
- If there are errors, review Troubleshoot: idresgen utility.
Related concepts
Related tasks
Related reference