Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop Data access resources > Develop data access applications > Develop data access applications


Recreating database tables from the exported table data definition language

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.

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.

    • Save the file to a working directory, such as C:\temp, on your DB2 machine.

  2. Run the Table.ddl file.

    • Run the command C:\temp>db2cmd, replacing C:\temp with your chosen directory. A DB2 command window is displayed, in which you runs (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

      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.


Results

The database tables are created.

+

Search Tips   |   Advanced Search