dtdgen utility

The dtdgen utility creates document type definition (DTD) file and (optionally) XML schema definition (XSD) files for use with the loading utilities based on the target database to which your data must conform. The DTD specifies structural elements and markup definitions that can be used within the XML data document and the DTD describes the tables and columns into which the massload utility imports data. For example, a DTD can list elements to be used in a document and specify the attributes that each element can take.

If the target database structure does not change, the dtdgen utility needs to be run only once.

The wcs.dtd file located in WC_installdir \schema\xml is provided with WebSphere Commerce. If you use this DTD or the DTDs provided with the starter store archives and you do not modify the database schema, you normally do not need to generate a DTD using the dtdgen utility.

Before running this utility, ensure that you have complete the required configuration tasks:

  1. Configure the environment variable setting scripts.
  2. Configure tracing and logging for the loading utilities.
  3. Optional: Create a text file containing the list of database tables for which you want to generate a DTD file. The full path to this file name is specified in the -infile parameter. If you do not create this file, you must specify the list of database tables for which you want to generate a DTD file in the -tablenames parameter.

Filenames 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 dtdgen utility.

In addition to the trace log and message log for the loading utilities, this utility produces the following log file:

  • DB2WC_installdir/logs/dtdgen.db2.log
  • OracleWC_installdir/logs/dtdgen.oracle.log
  • WebSphere Commerce Developer No additional logs files are produced.

SolarisLinuxAIX Run this utility as the non-root WebSphere Commerce user ID. Do not run this command as root.

dtdgen utility syntax diagram. See the list called Parameter values for the applicable parameters.

Utility command

The dtdgen utility has the following file name:

  • For IBM i OS operating systemSolarisLinuxAIX dtdgen.sh
  • Windows dtdgen.cmd
  • WebSphere Commerce Developer dtdgen.bat

Parameter values

-dbname
  • Apache DerbyWebSphere Commerce Developer Do not specify this parameter.
  • SolarisLinuxAIXWindows Name of the target database.
  • For IBM i OS operating systemThe database name as displayed in the relational database directory (WRKRDBDIRE).
DB2
Note: If your database is on a remote IASP and the database name is different than the hostname, the value of dbname that is passed to a utility is:
-dbname "hostname/schemaName;database name=db_Name;cursor hold=false"
For example,
-dbname "TORASCAT.yourcompany.com/demo;database name=CATDB;cursor hold=false"
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.
-dbuser
  • Apache DerbyWebSphere Commerce Developer Do not specify this parameter.
  • For IBM i OS operating systemSolarisLinuxAIX Name of the user connecting to the database
  • For IBM i OS operating system This is usually the same as the instance user name.
-dbpwd
  • Apache DerbyWebSphere Commerce Developer Do not specify this parameter.
  • Password for the user connecting to the database.
-outfile
Name of the output DTD file.
-infile
Name of an input text file containing a database-table name on each line.
-tablenames
Name of table or or tables for which you want to generate a DTD file. You can specify any of the following values:
Single database table name
When you specify a single database table name, the generated DTD file only reflects that database table.
Comma-separated list of database table names
To specify multiple table names, separate each table name with a comma (","). The generated DTD file reflects the tables specified.
*
Specifying an asterisk ("*") for the -tablenames parameter generates a DTD covering all tables in the database.
-xmlTableDesc
Optional: Specify this parameter to generate an XSD file for the tables specified in the -tablenames parameter. You must specify the full path to the XSD file that is generated.
-schemaname
Optional: Name of the target database schema. If this parameter is not specified when running the utility, the utility looks for a name=value pair in the customizer property file that specifies the value of SchemaName. If this pair is present in the property file, the utility uses the value specified. If neither a command-line nor a property-file specification for this parameter exists, the utility defaults to the name of the database user.
-customizer
Name of the customizer property to be used for your WebSphere Commerce database. When specifying the customizer property file with this parameter, omit the ".properties" file extension.

Specify one of the following customizer values:

  • Apache DerbyWebSphere Commerce Developer Do not specify this parameter.
  • SolarisDB2LinuxAIXWindows(Not required) Do not specify this parameter.
  • For IBM i OS operating systemDB2Required: Specify one of the following values:
    ISeries_GENWCSDTD_Customizer

    Specify this customizer value if you are using the native system i JDBC driver. When you specify this value, the dtdgen utility uses the values specified in the following file: WC_installdir/properties/ISeries_GENWCSDTD_Customizer.properties

    Toolbox_GENWCSDTD_Customizer

    Specify this customizer value if you are using the IBM Toolbox for Java JDBC driver. When you specify this value, the dtdgen utility uses the values specified in the following file:

    WC_installdir/properties/Toolbox_GENWCSDTD_Customizer.properties

    If you specify this customizer value, you must specify the hostname as the -dbname parameter. The following is an example of invoking the dtdgen utility:

    ./dtdgen.sh -dbname MY.HOSTNAME.COM -dbuser instance -dbpwd mypass
    -outfile /path/out.dtd
    method sqlimport -customizer Toolbox_GENWCSDTD_Customizer -infile
    /path/file.xml
  • Oracle Required: OracleConnectionCustomizer

    When you specify this value, the dtdgen utility uses the values specified in the following file: WC_installdir/properties/OracleConnectionCustomizer.properties

Example

The following example command generates a DTD file for the MEMBER, MEMBERADDRBOOK, and database tables in a DB2 database called MALL. The database table names are defined in a file called tablenames.txt.

  • SolarisLinuxAIX ./dtdgen.sh -dbname host:port/mall -dbuser myname -dbpwd mypassword -outfile threetables.dtd -infile tablenames.txt
  • For IBM i OS operating systemdtdgen.sh -dbname MY.HOSTNAME.COM -dbuser instance -dbpwd mypass -outfile /path/out.dtd -customizer Toolbox_GENWCSDTD_Customizer -infile tablenames.txt -schemaname instance
  • Windows dtdgen.cmd -dbname host:port/mall -dbuser myname -dbpwd mypassword -outfile threetables.dtd -infile tablenames.txt

The output from this command is shown in Example: wc.dtd output from dtdgen utility.