Generate data definition language
We can generate data definition language (DDL) if there are features in the server configuration that require access to a database.
Complete the following steps before we run the ddlGen utility:
- Start the server.
- Export the code...
-
JAVA_HOME=<java64_path>
...where <java64_path> is the path to a 64-bit Java 8.0 or later software development kit (SDK).
- Export the code...
-
PATH=$JAVA_HOME/bin:$PATH
Now the ddlGen utility can find Java.
- 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.
The utility generates data definition language (DDL) for each feature configured in the server that requires access to a database. We 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.
- In the server.xml file, add the localConnector-1.0
feature under the featureManager tag.
<featureManager> <feature>localConnector-1.0</feature> </featureManager>
- In a command line, run...
-
wlp/bin/ddlGen {generate|help} <server_name>
where <server_name> is the name of the server we want to generate DDL for.
The following table shows the nonzero codes that might be returned:
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 WLP_USER_DIR variable 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. |
25 | The server output directory was not found. This error can occur if the value of the WLP_OUTPUT_DIR variable does not match the value used by the server. |
255 | An unexpected error occurred. |