Tool Mentors > Rational Rose Tool Set > Rational Rose Tool Mentors > Designing and Modeling Databases Using Rational Rose Data Modeler

Purpose

This tool mentor describes creating a data model with Rational Rose Data Modeler and generating a new DDL or database schema from the Rose data model.

Related Rational Unified Process information: Activity: Database Design.

Overview

Rose Data Modeler features allow the database designer and the software developer to communicate requirements using the same tool. As a database designer or developer, you can use Rose Data Modeler to model and design databases, and to integrate your application and database.

You can model and design a database using an object model transformed to a data model or by reverse engineering an existing database schema or DDL script to create a data model. Using Rose Data Modeler transformation options, you can integrate application and database designs. Transformation options map elements contained in an object model to create a data model, or transform elements in a data model to create an object model. You must understand object-oriented analysis and design (OOAD) concepts and the Unified Modeling Language (UML) to create the object model. Creating a data model requires understanding relational database design. Rose Data Modeler uses database terminology and UML stereotypes to represent database elements.

Rose Data Modeler uses or creates three model types—an object model, a data model, and an optional data storage model. An object model represents classes, their behaviors, and the relationships between classes. The Rose class diagram represents a view of the object model. A data model  represents the structure of the database as implemented by the enterprise. The optional data storage model represents the physical storage structure of the database.

Using a Rose class diagram created by a software developer, you can create a Rose data model diagram. In your Rose class diagram, you model the classes required to integrate your application with the database. Only persistent classes transform from the object model to a Rose data model. The persistent classes must be assigned to a component and be located in the same logical package.

Tool Steps

There are three ways you can begin to model a database using Rose Data Modeler:

  1. Reverse engineer a DDL script or database schema
  2. Transform an object model to a data model diagram
  3. Build a data model

From your data model diagram, use Rose Data Modelerís Forward Engineering Wizard to generate and execute a DDL script to create a database schema.

1. Reverse engineer a DDL script or database schema To top of page

Use the Rose Data Modeler Reverse Engineering Wizard to generate a data model. You can reverse engineer a DDL script or database schema for a DBMS supported by Rose Data Modeler. Rose Data Modeler supports ANSI SQL 92 standard databases or the following DBMSes:

  • DB2 DBMS versions MVS and UDB
  • Oracle DBMS 
  • SQL Server DBMS 
  • Sybase Adaptive Server 

The Reverse Engineering Wizard reads the database schema or DDL file and creates a data model diagram that includes the names of all quoted identifier entities. Depending on the DBMS, Rose Data Modeler Reverse Engineering Wizard models tables,  relationships between tables, stored procedures, indexes, and triggers in the data model diagram.

In the data model diagram, add tables, define relationships, indexes, and domains, and apply third normal form to the elements. Then transform the data model to an object model or forward engineer the data model to generate a DDL script or database schema. 

2. Transform an object model to a data model diagram To top of page

Using Rose Data Modeler, you can transform an object model to create a Rose data model. Before transforming an object model to a data model diagram:

  • Set the state of classes to persistent.
  • Assign classes to a component that uses the languages Java, Visual Basic, or Analysis.
  • Group the classes in the same logical package.

Object model elements transform to the Rose data model elements using data type mappings specific to the selected DBMS. When the transformation is complete, begin working in the Rose data model diagram. In the data model diagram, capture changes required in the database schema needed to integrate with a software application. From the data model diagram, use the Forward Engineering Wizard to generate a DDL file or database schema.

3. Build a data model To top of page

You build a data model using Rose Data Modeler. First, you model a schema. To model a schema, create a database for a Rose Data Modeler supported DBMS. Creating a database enables DBMS connectivity and Rose Data Modelerís forward engineering features and compare/synchronization functions. 

Next, create a schema and assign it to the database. Create a data model diagram to model your schema. When creating a data model in Rose Data Modeler, you must create a data model diagram, rather than a Rose class diagram, to graphically depict  tables and their relationships in a data model. 

Add tables to the schema in the data model diagram. You can create a data model by defining tables, columns, keys (primary and unique), constraints, and indexes, and establishing relationships between tables. For each table, create columns, assign data types supported by the DBMS, declare a primary key, and apply constraints. Establish relationships between tables in the schema. In Rose Data Modeler you can also create custom triggers, domains, and stored procedures. After completing the data model diagram, use the Data Modeler Forward Engineering Wizard to generate a DDL script or database schema.

Data Storage Model To top of page

You model the physical storage of your data by creating a data storage model. A data storage model consists of a database that contains one or more tablespaces. A tablespace is a logical storage element that stores your table data. You can assign one or more tables to your tablespace and evenly distribute your table data across one or more containers. A container is a physical storage device, such as a disk, file, or directory. Each container is segmented into extents or pages and measured in kilobytes. 

When you create a data storage model you first create a database. Then you create a tablespace. As part of creating a tablespace you can assign it one or more containers and one or more tables. When you create a tablespace, a dependency relationship is automatically created between the database and tablespace.

Forward Engineering a Rose Data Model To top of page

Use the Rose Data Modeler Forward Engineering Wizard to generate a DDL or database schema from your data model diagram. The Forward Engineering Wizard reads the schema in the data model and generates a DDL script for the DBMS you specified in the wizard. In the wizard, you can choose to execute the DDL script to generate a database schema.

In the Forward Engineering Wizard, you select options to generate:

  • Tables
  • Indexes
  • Triggers
  • Stored Procedures
  • Views
  • Tablespaces
  • Fully qualified names to prefix the schema name to table names
  • Quoted identifiers for tables, columns, and schemas required for localization using double-byte code set (DBCS)
  • SQL drop statements to overwrite existing DDL scripts, database elements, or comments

For details, see the Rose Data Modeler online Help.

Copyright  © 1987 - 2001 Rational Software Corporation


Display Rational Unified Process using frames

Rational Unified Process