Reference > Utilities


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 the 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_INSTALL \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 to generate a DTD file. The full path to this file name is specified in the -infile paramater. If you do not create this file, 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:

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


Utility command

The dtdgen utility has the following file name:


Parameter values

-dbname

  • Do not specify this parameter.

  • Name of the target database.

  • The database name as displayed in the relational database directory (WRKRDBDIRE).

For DB2 UDB databases, the Type 2 database name is deprecated, where the database names do not contain a prefix.

That is, the DB2 Type 4 JDBC driver is used instead, where the Type 4 database name is prefixed with the database server and port. For example, db_server:db_port/db_name.

If the 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"

See How JDBC applications connect to a data source in the DB2 Information Center for more information.

-dbuser

  • Do not specify this parameter.

  • Name of the user connecting to the database

  • This is usually the same as the instance user name.

-dbpwd

  • 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 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.

*

Specify 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 the WebSphere Commerce database. When specifying the customizer property file with this parameter, omit the ".properties" file extension.

Specify one of the following customizer values:

  • Do not specify this parameter.

  • (Not required) Do not specify this parameter.

  • Required: 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_INSTALL/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_INSTALL/properties/Toolbox_GENWCSDTD_Customizer.properties

    If you specify this customizer value, 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
    

  • Required: OracleConnectionCustomizer

    When you specify this value, the dtdgen utility uses the values specified in the following file:

    WC_INSTALL/properties/OracleConnectionCustomizer.properties.


Example

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

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


Related concepts

Overview of the mass load utilities

Transforming, loading, and extracting data using the WebSphere Commerce loading utilities


Related tasks

Configure the environment variable setting scripts

Generate a DTD

Related reference

Example: Output from dtdgen utility

massextract utility

idresgen utility

massload utility (Server environment)

txttransform utility

xmltransform utility


+

Search Tips   |   Advanced Search