WebSphere Commerce Developer

idresgen utility

The idresgen utility generates identifiers for XML elements with their associated identifiers. The XML files must have identifiers because the XML files map directly to the target database schema.

LinuxAIXWindowsFor IBM i OS operating systemFor information about the idresgen utility in the WebSphere Commerce server environment, see idresgen utility (Server environment).

If your XML content already supplies identifiers, you do not have to run the idresgen utility.

The idresgen utility includes an error reporter that generates a log file if there is an error.

The following are examples of situations in which you might want to use the idresgen utility:
  • Loading new content in XML format when identifiers for the data are required
  • Updating content when identifiers exist for an object in the database

The idresgen utility can supply actual identifiers, or identifiers can be resolved by using the following techniques:

Internal-alias resolution
To use internal-alias resolution with the idresgen utility, an alias is placed in the primary-key attribute (identifier) in the XML file. The alias can then be used throughout the XML file to refer to that element. This process eliminates the need for a program to determine the unique indexes necessary to build the XML file.
Properties-file specification
The idresgen utility in the loading utilities can use a Java properties file to determine which columns of a primary table should be used as lookups for tables that require the identifier of a primary table. A table is primary if it is listed in the KEYS or SUBKEYS table.
Unique-index resolution
In the idresgen utility, unique-index resolution uses any specified unique indexes on a table as a means of determining an identifier. For example, MEMBER_ID plus IDENTIFIER is a unique index on the CATALOG table. Therefore, this index can be used as a resolution point to the primary key CATALOG_ID of the CATALOGDSC table.

The idresgen utility can analyze the database schema to determine whether a unique index fulfills its requirements. The idresgen utility looks for a unique index only when there is no entry in the properties file for the table that is being analyzed or when there is no properties file. If these conditions are true, a unique-index check is performed. The unique index is considered valid if it exists and does not include the primary key for the table.

File names that are specified as parameters for this utility can be preceded by relative or absolute paths. Relative paths must be relative to the directory from which you run the idresgen utility.

Important: The wcs.dtd file must be in the same directory as the infile XML file.

Syntax

The syntax for the idresgen utility depends on which database you are using as the development database:

  • Apache Derby idresgen syntax diagram
  • DB2 idresgen syntax diagram

Parameter values

Input XML file
Name of the input XML document that contains table records. The wcs.dtd file must be in the same directory as the XML file.
Output XML file
Name of the output XML file to be produced. This file can be used as input to the massload utility.
DB name
The name of the database into which you are loading data.
DB2Note: For DB2 UDB databases, the DB2 Type 4 JDBC driver is used, where the Type 4 database name is prefixed with the database server and port. For example, db_server:db_port/db_name.
DB user
The ID of a database user authorized to connect to the database.
DB pwd
The password for the database user.
DB schema
Optional: The name of the database schema into which you are loading data. Specify the schema name in uppercase letters.
Properties file
Optional: The full path to a text file that contains Java properties in the form of name-value pairs. The file is used to define the look-aside column names for foreign key identifier lookup and the select predicate for main table (such as CATEGORY and PRODUCT) queries. You can omit entries in this file for tables that have a unique index defined that does not include the identifier.

If you do not specify this parameter, the default file is used. The default file is WC_installdir/properties/IdResolveKeys.properties.

Note: The parameter value can be the path to a file for specifying unique-index data that might not necessarily be retrievable from the database. For example, if you are loading access control data, you can set the parameter value to be the path to the ACIdKeys.properties file:

WC_eardir/properties/ACIdKeys.properties

This file is used to resolve the ID values for access control data. If you need to update this file, the file requires 2 mandatory key and value pairs
NAMEDELIMITER
This key and value pair specifies the character that is used as a delimiter for column-names in the user-specified unique-index. For example, NAMEDELIMITER=@
SELECTDELIMTER
This key and value pair specifies the character that is used a delimiter for physical columns in the database that would comprise that unique-index. For example, SELECTDELIMITER=:
You can also add optional key and value pair information to specify unique-index information, such as table names and values that specify the ordering of the unique-index information. For example, ATTRIBUTE=@LANGUAGE_ID@NAME@CATENTRY_ID: LANGUAGE_ID NAME CATENTRY_ID , where
  • ATTRIBUTE is the table for which the user-defined unique index is specified.
  • @LANGUAGE_ID@NAME@CATENTRY_ID are the column names (language_id, name, catentry_id), or aliases that idresgen utility assumes for the column names, within the user-defined unique-index
  • LANGUAGE_ID NAME CATENTRY_ID are the actual names of the database columns for the user-defined unique index. The column names must be separated by spaces within the file