Running the ddlGen utility

You can generate data definition language (DDL) if there are features in the server configuration that require access to a database.

Before you begin

Complete the following steps before you run the ddlGen utility:
  1. Start the server.
  2. Export the code JAVA_HOME=<java64_path>, where <java64_path> is the path to a 64-bit Java 8.0 software development kit (SDK).
  3. Export the code PATH=$JAVA_HOME/bin:$PATH. Now the ddlGen utility can find Java.
  4. Export the code WLP_USER_DIR=<wlp_path>, where <wlp_path> is the path to the root of the Liberty server configuration. For example, if server1 is configured at the path /wlpconfig/servers/server1, the WLP_USER_DIR is equal to /wlpconfig.
  5. If the server is configured to write output to a different path by setting the code WLP_OUTPUT_DIR=<output_path> in the server.env environment, also export the code WLP_OUTPUT_DIR=<output_path> before you run the ddlGen utility. If you do not export this code, the ddlGen utility fails with the following message: CWWKD0101E: The server named <server> is not configured to accept local JMX requests.

About this task

The utility generates data definition language (DDL) for each feature that is configured in the server that requires access to a database. You can change the path that the ddlGen utility uses to search for the server by exporting the environment variable, WLP_USER_DIR, in the command line where the utility is run.

Procedure

  1. In the server.xml file, add the localConnector-1.0 feature under the featureManager tag.
    <featureManager>
         <feature>localConnector-1.0</feature>
    </featureManager>
  2. In a command line, run the wlp/bin/ddlGen {generate|help} <server_name> command, where <server_name> is the name of the server that you want to generate DDL for.

Results

The following table shows the nonzero codes that might be returned:

Table 1. Return codes and explanations for the ddlGen utility
Return Code Explanation
0 Success. The DDL is generated to ${server.output.dir}/ddl.
20 The action provided is not valid.
21 The server was not found. Message CWWKD0100E shows the file system directory where the utility looked for the server. This location can be changed by exporting the variable, WLP_USER_DIR, in the command line where the utility is run.
22 The localConnector feature is not present in the server configuration or the server was not started.
23 The MBean that generates DDL was not found.
24 The MBean that generates DDL reported an error. The server logs contain more details about the error.
255 An unexpected error occurred.

Icon that indicates the type of topic Task topic

File name: twlp_ddlgen.html