Recreating database tables from the exported table data definition language

When the WebSphere Application Server 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.

About this task

The following steps demonstrate the process for creating tables in DB2.

Procedure

  1. Extract the Table.ddl file from your CMP enterprise bean JAR file and save it on your database server.
    • [AIX HP-UX Linux Solaris Windows] Save the file to a working directory, such as C:\temp, on your DB2 machine.
    • [z/OS] Save the file to a temporary directory on your work station. Transfer the file to a data set on your DB2 for z/OS system.
    • [iSeries] Save the file to a working directory in the integrated file system on your DB2 UDB for iSeries server.
  2. Run the Table.ddl file.
    • [AIX HP-UX Linux Solaris Windows] Run the command C:\temp>db2cmd, replacing C:\temp with your chosen directory. A DB2 command window is displayed, in which you enter the following commands (replacing C:\temp with your chosen directory):
      1. C:\temp>db2 connect to your_db_name
      2. C:\temp>db2 -tf Table.ddl //This command runs and creates tables for your CMP enterprise bean.
      3. C:\temp>db2 disconnect all
      [AIX] [HP-UX] [Solaris] Note: If you run DB2 on supported UNIX systems, use these same commands. Run them from a user with permissions for DB2, rather than from a DB2 command window.
    • [z/OS] Specify the data set as the input data set to SPUFI, and run the program.
    • [iSeries] Add an SQL CREATE statement to the Table.ddl file, then run the file:
      1. Start iSeries Navigator.
      2. Expand the iSeries icon for the system where you want to create the database file.
      3. Expand Database, and right-click on the system database.
      4. Select Run SQL Scripts...
      5. Select File > Open.
      6. Navigate to the Table.ddl file that you extracted, and select Open.
      7. Create a database, or collection, in the file by typing the following SQL statement as the first statement in the Table.ddl file:
        CREATE COLLECTION
        collection
        ;
        where collection is the name of your database.
      8. Select Run > All to run all of the commands that are contained within the Table.ddl file.
      9. Select View > Job Log... and verify that the table was created successfully.
      10. Select File > Save to save the database.

Results

The database tables are created.
Task topic Task topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Aug 31, 2013 4:28:44 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=pix&product=was-nd-mp&topic=recdbddl
File name: tdat_recdbddl.html