The ID Resolver utility lets you choose the load, update, or mixed method to process the input file.
- 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.
Load method
The load method for the ID Resolver is used to generate new identifiers for the records that are loaded into the database. With this method, new identifiers are created for the records. The following example is used to generate identifiers for new data:
./idresgen.sh -dbname db -dbuser user -dbpwd pwd -infile input.xml -outfile output.xml -method load -customizer customizer -schemaname mall>Note: The load method is the default.
idresgen -dbname db -dbuser user -dbpwd pwd -infile input.xml -outfile output.xml -method load -customizer customizer -schemaname mallNote: The load method is the default.
Update method
If you specify the update method for the ID Resolver, the records in the input file should already exist in the database. The ID Resolver locates the identifiers in the database. If a record does not exist in the database, the ID Resolver will not be able to resolve the identifier for this record and it will indicate that an error has occurred. The following example is used to locate identifiers for data that already exist in the database:
./idresgen.sh -dbname db -dbuser user -dbpwd pwd -infile input.xml -outfile output.xml -method update -customizer customizer -schemaname mallidresgen -dbname db -dbuser user -dbpwd pwd -infile input.xml -outfile output.xml -method update -customizer customizer -schemaname mall
Mixed method
If the input data file contains records that already exist in the database as well as some records that are new, the ID Resolver must be run using the mixed method. With this method, the ID Resolver creates new identifiers for records only if the records do not exist in the database. Otherwise, the existing identifier is obtained from the database. The following example is used to generate identifiers for new data and to locate identifiers for data that already exist in the database:
./idresgen.sh -dbname db -dbuser user -dbpwd pwd -infile input.xml -outfile output.xml -method mixed -customizer customizer -schemaname mall
idresgen -dbname db -dbuser user -dbpwd pwd -infile input.xml -outfile output.xml -method mixed -customizer customizer -schemaname mall
Using duplicate-record checking with ID resolution
In order to improve performance, the Loader package eliminates duplicate XML elements early in the loading process, during ID resolution. You do not need to use any specific parameters to exploit this feature. When you use the update or mixed method with the ID Resolver utility, the ID Resolver automatically recognizes XML elements being resolved that are duplicates of records that already exist in the database. The duplicates are not written to the output file specified by the -outfile option; but the Loader package logs them to trace.txt file. The duplicate entries in the trace.txt file are made without counting the duplicates as actual errors.
Each element is checked for duplication by comparing that element's attributes to the corresponding database table columns. An element must always contain all of the attributes required by the DTD. However, elements may also contain optional attributes. In checking for duplicates, therefore, the ID Resolver uses all of the attributes contained by each element; if any one is different, the element is not considered to be a duplicate.
When you use the mixed method with the ID Resolver utility, only elements already determined to be non candidates for insertion are further processed to check for duplicates. This increases the efficiency of the process.
Duplicate-record checking is not performed by the ID Resolver when you use the load method because the loadable elements are not supposed to exist in the database when you use this method.
Note: Relationship elements (such as cattogrp and catgrprel) may not be reported as duplicates.