You can use IBM®
InfoSphere® Data Architect to design a new physical model and deploy it in a database.
Perform these tasks to create a new database design:
- Set up - Install and configure InfoSphere Data Architect
- Connect - Connect InfoSphere Data Architect to your Db2® database
- Create - Create your physical model
- Generate and deploy - Generate a DDL script for your physical model and run the DDL script to deploy the model
Before you perform these tasks, ensure that your database source contains the data that you want to upload to your Db2 database.
Set up
Follow these steps to install InfoSphere Data Architect:
- Log on to the Db2 web console.
- Download InfoSphere Data Architect from the web console.
- Install InfoSphere Data Architect.
Create
Follow these steps to create the model:
- In the InfoSphere Data Architect workbench, ensure that Data perspective is active.
The default perspective is the Data perspective. If the Data perspective is not active, click . The Data option does not show in the menu if the Data perspective is active.
- Create a new data design project by clicking .
- In the New Data Design Project window, enter the name of the project (such as
new-database-design
) and click Finish. The new data design project appears in the Data Project Explorer view.
- In the Data Project Explorer view, right-click Data Models and select .
- In the New Physical Data Model window, select the destination folder and enter the file name for the new physical model. Select DB2 for Linux, UNIX, and Windows as the database and V10.5. Then, click Finish.
For more information about physical models, see Physical data models.
- In the Diagram1 view that opens, start creating tables. Right-click anywhere inside the Diagram1 view and select .
For more information, see Adding or deleting objects from a physical data model diagram.
- Add columns to your tables. Right-click the table object and click .
Repeat this step until you create all columns for the table. Also, use this Add Data Object menu to create indexes, keys, and triggers for a table.
- Repeat steps 6 and 7 until all tables and views are created.
- Click to save the physical model.
Generate and deploy
Follow these steps to generate and then deploy a DDL script to create your schema:
- Generate a DDL script from the physical data model that you created in the Create task. In the Data Project Explorer view in InfoSphere Data Architect, right-click Database and select Generate DDL.
- In the Generate DDL window, select the options that you want to use and click Next. For example, select only Fully qualified names, Quoted identifiers, and CREATE statements just to generate CREATE statements with fully qualified names and quoted identifiers.
- In the Objects page of the Generate DDL window, select the database objects that you want to create in your Db2 database. Click Next.
- In the Save and Run DDL page of the Generate DDL window, select Edit and run DDL in the SQL editor to edit the script and click Next.
- In the Summary page of the Generate
DDL window, click Finish.
- In the SQL editor view for the script, remove the
COMPRESS NO
clause from the CREATE TABLE
statements. This clause is not supported when you create column-organized tables. Also, make any additional changes to the script; for example, change the default schema name from Schema
to your Db2 schema name, which might be the same as your Db2 user name.
- Click Run SQL. The following example shows
the edited script without the
COMPRESS NO
clause
and the Run SQL button to click:
- In the Select Connection Profile window, select the connection for the Db2 database. Click Finish.
- Check the status of the script in the SQL Results window. A check mark indicates that the schema was successfully created in the Db2 database. Congratulations! If the status shows
Failed
, click the status to see the details. To fix the problem repeat the steps to modify The DDL script and run it again.