Recreating database tables from the exported table data definition language

 

Overview

When the WAS deployment tooling deploys an EJB jar file containing container-managed persistence (CMP) enterprise beans, it selects the target database and creates a corresponding Table.ddl file. This file contains the SQL statement necessary to generate the database table for your CMP beans. You must then run the ddl file on your database server to create the tables.

Following is an example of how to use such a Table.ddl file for DB2, on Windows and z/OS:

 

Procedure

  1. The container-managed bean (CMP) enterprise bean JAR file has a Table.ddl file that the assembly tool generates. Extract the Table.ddl file to a working directory such as C:\temp.

  2. Run this command -- C:\temp>db2cmd A new command window appears in which you enter the following commands.

  3. Run this command -- C:\temp>db2 connect to dbname

  4. Run this command -- C:\temp>db2 -tf Table.ddl The command runs and creates tables for your CMP enterprise bean.

  5. Run this command -- C:\temp>db2 disconnect all

    Note: If you use DB2 on Unix, use these same commands. Simply run them from a user with permissions for DB2, rather than from a DB2 command window.