0% found this document useful (0 votes)
55 views

Dbintfc

This document provides an overview of how PowerDesigner supports database interface functionality including database generation, reverse engineering, and trigger/stored procedure generation. It describes definition files that contain database-specific syntax and mapping information to enable these functions for over 30 database brands. It also briefly mentions database connect files which handle generation for databases using non-ODBC drivers.

Uploaded by

hnr.uninstall
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

Dbintfc

This document provides an overview of how PowerDesigner supports database interface functionality including database generation, reverse engineering, and trigger/stored procedure generation. It describes definition files that contain database-specific syntax and mapping information to enable these functions for over 30 database brands. It also briefly mentions database connect files which handle generation for databases using non-ODBC drivers.

Uploaded by

hnr.uninstall
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

ADVANCED TECHNICAL

DOCUMENTATION

Database Interface Guide


POWERDESIGNER 6.1
December 1997
Copyright Ó 1991-1997 Sybase, Inc. and its subsidiaries.
All rights reserved.
Printed in the United States of America.
Information in this manual may change without notice and does not represent a commitment on the part of
Sybase, Inc. and its subsidiaries.
The software described in this manual is provided by Powersoft Corporation under a Powersoft License
agreement. The software may be used only in accordance with the terms of the agreement.
No part of this publication may be reproduced, transmitted, or translated in any form or by any means,
electronic, mechanical, manual, optical, or otherwise, without the prior written permission of Sybase, Inc. and
its subsidiaries.
Sybase, Inc. or its subsidiaries claim copyright in this program and documentation as an unpublished work,
revisions of which were first licensed on the date indicated in the foregoing notice. Claim of copyright does
not imply waiver of other rights of Sybase, Inc. and its subsidiaries.
ClearConnect, Column Design, ComponentPack, InfoMaker, ObjectCycle, PowerBuilder, PowerDesigner,
Powersoft, S-Designor, SQL SMART, and Sybase are registered trademarks of Sybase, Inc. and its
subsidiaries. Adaptive Component Architecture, Adaptive Server Anywhere, Adaptive Server Enterprise,
Adaptive Warehouse, AppModeler, DataArchitect, DataExpress, Data Pipeline, DataWindow, dbQueue,
ImpactNow, InstaHelp, Jaguar CTS, jConnect for JDBC, MetaWorks, NetImpact, PowerDynamo, Optima++,
Power++, PowerAMC, PowerBuilder Foundation Class Library, Power J, PowerScript, PowerSite, Powersoft
Portfolio, Powersoft Professional, PowerTips, ProcessAnalyst, Runtime Kit for Unicode, SQL Anywhere, The
Model For Client/Server Solutions, The Future Is Wide Open, Translation Toolkit, UNIBOM, Unilib, Uninull,
Unisep, Unistring, Viewer, WarehouseArchitect, Watcom, Watcom SQL Server, Web.PB, and Web.SQL are
trademarks of Sybase, Inc. or its subsidiaries. Certified PowerBuilder Developer and CPD are service marks
of Sybase, Inc. or its subsidiaries. DataWindow is a patented proprietary technology of Sybase, Inc. or its
subsidiaries.
AccuFonts is a trademark of AccuWare Business Solutions Ltd.
All other trademarks are property of their respective owners.
PowerDesigner Database Interfaces

About this This document presents details of the treatments by PowerDesigner for many
document common databases.

Contents Topic Page


Introduction 2
Database Generation 6
Supported SQL Commands 19
Translating Conceptual Data Types 21
DB2 Connection using ODBC-32 bit 27
Informix 5 and 7 Connection using ODBC-32 bit 34
Informix 7 Database Generation 42
Microsoft Access 95 & Access 97 Connection-32 bit 44
Microsoft Access Database 47
Microsoft SQL Server Connection using ODBC-32 bit 50
Oracle 8 Connection using ODBC-32 bit 56
Sybase SQL Anywhere 5.x Connection using ODBC-32 bit 64
Sybase SQL Server System 10 and System 11 ODBC Connection-32 bit 71
Sybase SQL Server 11 database 75
Introduction
The current Database Interface documentation is a first version.
Some information is missing. The modify database process and the alter table
statements are not explained. The generation and reverse engineering sheets
are incomplete: the specifics of the databases are not listed (for example,
clustered/nonclustered for Sybase)
PowerDesigner supports the following three functions when working with
databases:
¨ Database Generation: Generate physical databases via ODBC Open
Database Connectivity or DDL Data Definition Language scripts for
more than 30+ RDBMS
¨ Reverse Engineering: Generate physical models from existing databases
¨ Triggers and Stored Procedures: Generation of database specific triggers
and stored procedures

Definition files
Much of the power and flexibility of PowerDesigner is derived from a
flexible and open architecture in which database specifics are applied when
the user selects the target RDBMS of the physical model.
PowerDesigner stores database syntax specifics in DEF (definition) files.
These files are a required component of PowerDesigner. They are used to
determine database specific capabilities and SQL syntax for all three areas it
supports: DDL script generation, trigger and procedure generation, and
reverse engineering.
Currently, PowerDesigner supports over 30 database brands, and several
versions of those brands, resulting in more than 75 DEF files. This includes
support for the majority of all production database systems.
Both the Conceptual Data Models (CDM) and Physical Data Models (PDM)
use the DEF files. PowerDesigner includes a DEF file for each database it
supports. DEF files reside in the \PWRS\PD6\DEF directory and they can be
customized to meet your specific needs.

2
Each DEF file is made up of the following sections, described below in
greater detail:
¨ Database characteristics
¨ Database command definition
¨ Data type translation tables
¨ Trigger parameters
¨ Trigger template definitions

DEF file parameters


DEF files include the following parameters:

Parameter What it indicates


Database The main characteristics of the RDBMS, for example:
characteristics Support for foreign keys
Unique constraints
Position of the constraint name
End of command character…..

Database Commands for creating and dropping tables, columns, indexes,


Commands and views
Default values for database options
Functions supported by the target RDBMS
Generated Instructions for executing single or multiple scripts for the
script target RDBMS
Trigger-related Trigger variables, generation parameters; and definitions
Code for trigger templates (default insert, update, and delete
triggers) for the target RDBMS
Data Mapping of DataArchitect conceptual data types to the physical
translation data types of the target RDBMS.
tables Map the ODBC data types or restrict the data types for the
trigger generation.

Each section of the DEF file is composed of a series of fields with associated
values. These fields are parameters recognized by PowerDesigner. All of the
DEF files have the same structure, regardless of the target database. Certain
field values are customized depending on what the database supports. Values
for unsupported functionality will not appear in that database’s DEF field.

3
Every effort has been made to allow total control of the generation process
via the DEF file. However some functionality cannot be defined in the DEF
file. For example: The compute database size formula for the database
generation function is hard coded. Plus the specifications for triggers, stored
procedures, and views for the reverse engineering function are hard coded in
the application.
$ For more information on DEF files, see the Definition File Reference
Guide (DEFFILE.PDF) or the DEF FILE appendix in PowerDesigner User
Guides.

Database connect file


PowerDesigner also supplies database connect (DBC) files. These files have
the same structure as a DEF file. DBC files were developed to handle the
scenario where: the target database driver is a level one driver, and the script
PowerDesigner generates is in a different format from the script generated for
the Open Database Connectivity (ODBC) driver. An example of this is
Microsoft Access generation via ODBC. The script PowerDesigner produces
is a BASIC file format.
The DBC files reside in the \PWRS\PD6\DEF directory. The following
databases have DBC files:

Database Filename
Microsoft Access 2.0 ACCESS20.DBC
Microsoft Access 95&97 ACCESS95.DBC
PARADOX 5 & 7 for Windows PDOXWIN5.DBC
Microsoft Visual FoxPro 3.0 VFOXPRO.DBC
Microsoft Visual FoxPro 5.0 VFOXPRO5.DBC

You can determine if the database is a NON SQL database by checking the
DEF file. If SQLSupport = NO then that database is a NON SQL database.
PowerDesigner automatically checks the ODBC Syntax option when it
creates a NON SQL database.

4
Generating a Script file
PowerDesigner will generate a script for ANSI SQL databases, such as
R:BASE, Teradata and UNIFY. A universal SQL interpreter can read the
scripts. PowerDesigner has the following two scenarios that it uses when it
generates the script file:
¨ NON SQL database script generation without the ‘ODBC syntax’ option
on will use the DEF file. For example, the output for a Microsoft Access
95 database is in BASIC.
Begin Table DIVISION
Name = Division
Begin Column
¨ NON SQL database script generation with the ‘ODBC syntax’ option on
will use the DBC file. For example, the output of a Microsoft Access 95
database is in ODBC format.
Create table DIVISION
(
DIVNUM Integer,
DIVNAME Text (30), …..

Generation via ODBC


PowerDesigner performs four different types of generation via ODBC
depending on the specified RDBMS you are targeting.
¨ Database generation via ODBC is based on the hard coded ODBC
syntax for the following databases; Oracle 7 & 8, Sybase 10 & 11,
Adaptive Server 11.5, DB2 MVS, DB2 CS, Informix 7, Sybase SQL
Anywhere, SQLBase, Watcom
¨ ODBC database generation is performed using the DBC files for the
following databases; Microsoft Access 2.0/ 95/97, PARADOX 5 & 7 for
Windows, Microsoft Visual FoxPro 3.0 and 5.0. The Create Database
option automatically checks the ODBC syntax switch
¨ ODBC database generation for Standard SQL Databases is performed
for the following databases: Oracle 6, and Sybase 4. The Create
Database option generates SQL Script that is recognized by the ODBC
driver
¨ When generating for Non SQL databases such as RBASE, Teradata, and
Unify you must select the ‘ODBC syntax’ to ensure that the script does
not contain any NONANSI SQL statements

5
Database Generation
PowerDesigner will generate the database or the database creation script
from object definitions in the PDM (physical data model). Generation
parameters and options control the outcome of the generation process.
The availability of a generation parameter or option depends on the target
RDBMS. It is specified in the DEF file for the RDBMS. Parameters and
options that are not available for the target RDBMS are disabled in the
Parameters dialog box.

6
Generation Options
The generation parameters let you designate selected database objects for
generation. For example, the List parameter in the Tables group box lets you
select specific tables.

Depending on the RDBMS the ODBC syntax option generates script in


ODBC syntax instead of DBMS-specific syntax. If you do not select ODBC
syntax, DataArchitect uses the proprietary syntax of the RDBMS.

Database Generation Options


Object Option
PDM object If the RDBMS does not support an object, that check box is
grayed in the Generation dialog box.
If the database does not support an object, the object command in
the DEF file is equal to NO.
Create Create the physical database in the specified RDBMS.
database

7
Object Option
Create Table Create physical database table and its columns.
Tables can be defined with either Names or Codes depending on
the Generation Option selected.
In specific database the primary key is autoindexed. In this case,
you cannot select the Primary Key Constraint option and the
Primary Index option at the same time.
Table Primary Not all databases support primary keys. The generation of a
Key primary key is RDBMS specific. User can either generate
primary key indexes or primary key constraints. PK
Constraint can be autoindexed to the primary key column.
In specific database the foreign key is auto indexed. In this case,
you can not select the Foreign Key Constraint option and the
Foreign Key Index option at the same time.
Table Foreign Not all databases support foreign keys. The generation of a
Key foreign key is RDMS specific. Users can either generate foreign
keys or foreign key constraints. The generation of foreign keys
and foreign key constraints is mutually exclusive.
Declarative If the RDBMS supports declarative integrity you can control the
integrity way it is generated by defining the type of generation in the
Generate Option dialog box. Select either Trigger or
Declarative Integrity.
Not all databases support declarative integrity. The generation of
declarative integrity is RBDMS specific. Each of the
available referential integrity actions may be specified
separately for updates and deletes of the foreign key.
Table Not all databases support alternate keys. The generation of an
Alternate Key alternate key is RBDMS specific. The alternate keys is used to
define unique constraints.
Table Check The generating of table check parameters and validation rules are
RDBMS specific. Check parameters and validate rules are
defined on the Table Properties dialog box.
Table Not all databases support the generation of physical options for a
Physical table. Example of physical option are: PCTFREE, PCTUSE,
Options MAXTRANS, TABLESPACE, etc.
Table Begin Inserts customized script before the table creation command.
Script This command is present for every database PowerDesigner
supports.
Table End Places customized script after the last command of the table
Script creation script. This command is present for every database
PowerDesigner supports.
Table Not all RDBMS support comments on tables. If the database
Comments does comments are enter in the Table Properties Label field.

8
Object Option
Drop table Not all databases support the drop table statement. If the
RDBMS supports and the table exists, drop table.
Indexes Not all RDBMS support the creation of indexes. Indexes
typically are used to improve the speed of data retrieval from
tables.
Primary Key Index built on the primary key column of the table. The
Index generation will define an index on all of the primary key columns
in the order in which they appear in the table. The generation of
primary key indexes depends on the check box in the index
definition.
Foreign Key Index built on the foreign key column of the table. The
Index generation of foreign key indexes depends on the check box in
the index definition.
Alternate Key Index built on the alternate key column of the table. You can
Index build a unique index on an alternate key. The generation of
alternate keys depends on the check box in the index definition.
Other Index Indexes built on non-key column of the table.
Index Generate physical options for the index.
Physical
Options
Drop Index If index exists, drop index.
Create Create physical database columns for a table.
Column Columns can be defined with either Name or Code depending on
the Generation Option selected.
Create Views Views are not supported by all RDBMS. Views can be based on
one or more tables. Based on your selection of tables,
columns, and references PowerDesigner generates a query in
SQL syntax.
The resulting query uses FROM statements for tables and
WHERE statements for reference column joins.
View Not all RDBMS support comments on views. Comments are
comments generated from labels entered on the View Properties sheet.
Drop View If view exists, drop the view before creating new view.
Column user Are user defined data type domains in the table definition.
defined type
Column Must be defined for the column on the Check Parameter List of
default value Value dialog box.

9
Object Option
Column Column check parameters and validation rules are RDBMS
Checks specific. They must be defined on the Check Parameter Standard
Parameter/ Validation Rule dialog box.
Comment Define as the labels on the Column Properties dialog box.

Computing Database Size


In version 6.1 of the PowerDesigner product you can compute the estimated
size of the database you are generating. This generation is in kilobytes (Kb)
and can be performed for either the global model or one of the submodels.
The formula for estimating the size of a table takes in the following:
¨ Estimates the size of each column's data type
¨ Computes the average size of the record this is based on a composite of
several columns and takes into account some of the physical options
¨ Computes the average number of rows per database page
¨ Number of indexes in the database including primary key indexes,
foreign key indexes, and alternate key indexes. If the target database
supports the automatic indexing of keys, the resulting database size
estimation includes these indexes
$ For more details, see the Computing Database Size Reference
(DBSIZE.PDF).

Reverse Engineering
PowerDesigner’s reverse engineering function generates a physical model
from an existing database. It uses either the DDL scripts or an ODBC
connection. Reverse engineering is the process of "reading" a database
catalog or database creation script to construct a PDM. Once your physical
model is created you can then convert it into a conceptual model.
If you are Reverse Engineering from several script files, it is recommended
that you combine them all into a single file before performing the reverse
engineering. One script makes it easier for PowerDesigner to interpret the
relationships between the tables it is creating the model for. When
PowerDesigner reverse engineers from a database creation script, it only uses
the data type section of the target DEF file. This process is the same for every
database that PowerDesigner reverse engineers.

10
Database scripts
With database scripts, you use an existing database script as the selection for
the reverse. When DataArchitect reverse engineers from a database creation
script, it uses the data types in the DEF file for the specified RDBMS
database.

Database via ODBC


PowerDesigner must use ODBC to connect to a database. It uses the ODBC
connection to reverse engineers from a database catalog. OBDC provides an
open, portable, standard application programming interface (API). It also
provides support for either 16-bit or 32-bit environments.
The ODBC interface allows applications to access data in the DBMS using
Structured Query Language (SQL) as a standard accessing method. This API
provides access to relational and nonrelational database management systems
and other sources of data. The capabilities of the ODBC driver determine the
outcome of the reverse engineering process.

11
ODBC has four basic components:
¨ Application
¨ ODBC Driver manager
¨ ODBC Driver
¨ Data source

Application An application processes data by passing SQL statements through ODBC


function calls. DataArchitect is an ODBC-enabled application.
Tasks performed by the application include:
¨ Requesting a connection with the data source (DBMS)
¨ Sending SQL requests to the data source
¨ Defining storage area and data formats for query results
¨ Requesting results of SQL statements
¨ Processing errors of function calls or queries
¨ Reporting results to the user
¨ Requesting commit or rollback transaction control
¨ Terminating the data source connection

ODBC driver The ODBC driver manager mediates the interactions between the
manager application and the driver. The primary purpose of the ODBC Driver
Manager is to load drivers that implement the ODBC function calls the
drivers themselves implement ODBC function calls and interacts with a data
source. The driver manager then calls the same function exported by the
driver. The only exception to this sequence occurs when the function is
handled directly by the driver manager.
Tasks performed by the driver manager include:
¨ Using the ODBC.INI file to map a data source name to the appropriate
DLL
¨ Processing the ODBC initialization call
¨ Providing parameter validation for ODBC function calls

Driver The driver interacts with the data source. It processes the ODBC function
calls and submits SQL requests to a specific data source and returns the
results to the application. If necessary, the driver also modifies the SQL
statements to conform to the syntax supported by the data source. It also
interacts with any software layers necessary to access the data source.

12
Tasks performed by the driver include:
¨ Establishing a connection to the data source
¨ Submitting requests to the data source
¨ Translating data to/from other formats as needed
¨ Formatting and returning error codes to the application
¨ Initiating transactions if required by the data source

Data source The data source is the data and any component of the RDBMS required to
access the data. It consists of the data the user wants to access and its
associated operating system, DBMS, and network platform (if any) used to
access the DBMS.

ODBC Conformance
To achieve the goal of interoperability the ODBC specification defined two
types of conformance:

Type Description
API conformance Categorizes function calls supported by the driver
SQL conformance Categorizes SQL grammar and data types supported
by the driver

The reverse engineering capabilities of an ODBC driver depend on its level


of SQL conformance. ODBC defines conformance levels for drivers in two
areas: the ODBC API and the ODBC SQL grammar. Conformance levels
assist both the application and driver developers by establishing a standard
set of functionality. To claim that a driver conforms to a given API or SQL
conformance level, that driver must support all of the functionality in that
conformance level regardless of whether that functionality is supported by the
type of data source associated with the driver.
Levels of API Conformance: There are three levels of API conformance:
¨ Core
¨ Level 1
¨ Level 2

13
Levels of SQL Conformance: There are three levels of SQL conformance:
¨ Minimum
¨ Core
¨ Extended
Every ODBC driver supplied by PowerDesigner conforms to the Level 1 API
conformance level and the Minimum SQL conformance level. In addition,
most of the extended functions in the API Level 2 and the Core SQL
grammar level are supported. Each driver supports the same set of
functionality.
Core compliance Core compliance allows the following tasks to be performed:
¨ Allocate and free environment, connection, and statement handles
¨ Connect to a data source
¨ Prepare and execute SQL statements
¨ Execute SQL statements
¨ Assign storage for parameters in SQL statements and result columns
¨ Retrieve data from a result set
¨ Commit or rollback transactions
¨ Retrieve error information

Level 1 compliance Level 1 compliance allows the following tasks to be performed:


¨ Core functionality
¨ Connect to data source with driver specific, dialog box
¨ Set and Inquire values of statement on connection
¨ Execute SQL statements
¨ Assign storage for parameters in SQL statements and result columns

Level 2 compliance Level 2 compliance allows the following tasks to be performed:


¨ Core plus level 1 functionality
¨ Browse connection information and list available data sources
¨ Send arrays of parameter values. Retrieve arrays of result column values
¨ Retrieve number of parameters and describe individual parameters
¨ Use a scrollable cursor

14
¨ Retrieve native form of an SQL statement
¨ Retrieve catalog information including privileges, keys, and procedures
¨ Call a translation DLL

Minimum SQL Minimum SQL conformance represents the smallest subset of the X/Open
conformance and SQL Access Group (SAG) specification usable by ODBC. This level of
conformance is defined for ISAM and flat file drivers. The following
functionality is required for minimum SQL conformance:
¨ Required data definition language statements
CREATE TABLE
DROP TABLE
¨ Required data manipulation language statements
SELECT
INSERT
UPDATE
DELETE
¨ Required expressions
Multiplication
Division
Addition
Subtraction
¨ Required data types
CHAR
VARCHAR
LONG VARCHAR
The following functionality is not required:
¨ ALTER TABLE
¨ CREATE VIEW
¨ DROP VIEW
¨ CREATE INDEX
¨ DROP INDEX
¨ Subqueries in SELECT statements
¨ Aggregate functions

Minimum SQL Minimum SQL conformance impacts what is generated by PowerDesigner. In


conformance order for the Database Generation option to produce valid data types, the
impact on DEF file must contain a ‘Data types translation table from target database’s
PowerDesigner data types to ODBC data types’ (PhysOdbcDataType) section.

15
To receive valid data types from reverse engineering a database, the DEF file
must contain a ‘Data types translation table from target ODBC data types to
database data types’ (OdbcPhysDataType). These sections must be present in
the DEF file because the ODBC driver contains ODBC data types that are
not DBMS specific data types.
The Btrieve driver is an example of a minimum SQL conformance driver.
This driver reverse engineers only the table codes and the column codes.
Core SQL The core SQL conformance represents the remainder of the X/Open and SAG
conformance SQL CAE specification. It is the most common subset of SQL implemented
by DBMS. The following functionality (in addition to that required for
minimum SQL conformance) is required for core SQL conformance:
Required data definition language statements:
¨ ALTER TABLE
¨ CREATE VIEW
¨ DROP VIEW
¨ CREATE INDEX
¨ DROP INDEX
Required data manipulation language functionality:
¨ Sub-queries
¨ Aggregate functions
Data control language statements:
¨ GRANT
¨ REVOKE
Required data types:
¨ DECIMAL
¨ NUMERIC
¨ SMALLINT
¨ INTEGER
¨ REAL
¨ FLOAT

16
With a Core SQL conformance driver, PowerDesigner will generate a more
Core SQL accurate translation of the database types. When you reverse engineer a
conformance
database tables, columns, data types, and indexes are brought back. The
impact
Access driver is an example of this level conformance.
Extended SQL Extended SQL conformance represents ODBC and vendor-specific
conformance extensions to SQL. The following list identifies the functionality required for
extended SQL conformance:
¨ SQL extensions unique to ODBC
¨ Advanced SQL features and data types specific to different vendors not
described in the SQL specification
¨ DATE data type based on the ISO SQL standard for DATE literals
¨ TIME data type based on the ISO SQL standard for TIME literals
¨ TIMESTAMP data type based on the ISO SQL standard for
TIMESTAMP literals
¨ Outer Joins based on a subset of the SQL92 specification for outer Joins
¨ Scalar functions
¨ Stored procedures

Extended SQL Extended SQL conformance is generated by PowerDesigner. There are no


conformance problems with the datatype translations. Users can reverse engineer tables,
impact on columns, data types, indexes, primary keys, and foreign keys. The Sybase
PowerDesigner driver has extended SQL conformance.
$ For more details, see the Microsoft utility ADMNDEMO.EXE that
identifies what a particular ODBC driver can and can not reverse engineer.
This information is useful if the SQL conformance level of the driver for a
data source is unknown. Users can obtain the ADMNDEMO.EXE from
Microsoft.

v To reverse engineer from a database catalog:


1 Identify the database as a data source to ODBC.
2 Generate a PDM from the database catalog using ODBC.

Additional PowerDesigner uses the standard ODBC functions to reverse engineer the
Information database via ODBC, except for the physical options, the index physical
options, and the unique constraints. These three elements are defined in the
DEF file.

17
The three values are in the DEF file and can be customized by the user. The
following three values are brought back for the database:
¨ SQLTableOptions, the physical options for the table
¨ SQLIndexOptions, the physical options for the index
¨ SQLAkeyIndex, the unique (alternate key) constraints
A specific SELECT statements is used to reverse engineer default values,
check parameters, triggers, stored procedures, views, tablespaces and storage
for the following databases: Oracle 7 & 8, Sybase 10 & 11, Adaptive Server
11.5, DB2 MVS, DB3 CS, Informix 7, Sybase SQL Anywhere, SQLBase,
and Watcom. PowerDesigner does not support these options in databases not
included in this list.

18
Supported SQL Commands
PowerDesigner supports the same level of elements as the selected database
does. If the database does not support a particular function PowerDesigner
can not support it.

SQL Commands Description


Alter Table Adds new columns; adds, changes, or drops constraints;
and changes constraints.
Begin …End Script Encloses a series of SQL statements, such as If…else, that
affect the performance of the whole group.
Model level – allows users to define a database
environment. For example, using the set statements to
define database behavior, or granting some users
privileges.
Table level – allows you to add comments, to grant user on
the new table, or to create specific object on the table
using the alter table statements.
Create Database Create a database for initial use.
Create Function Creates a stored function.
Create Index Creates an index on one or more columns in a table.
Indexes can be created for Primary Keys, Foreign Keys,
Alternate Key, and Unique values.
Create Procedure Create a stand-alone stored procedure that can take one or
more user-supplied parameter.
Create Table Used to create the basic structure to hold data on any
database will define the primary key and foreign key
constraint for the table. PowerDesigner does not define
these at the column level.
Primary key – managed at the table level
Foreign Key – managed at the table level
Unique Constraint – managed at the table level
Referential Integrity – either declarative or trigger based
Check Parameters Table level – check integrity constraints offer an
alternative to using rules and triggers and are specific to
the table they are created for.
Column level – limit the values the users can insert into a
column of a table

19
SQL Commands Description
Create View Used to create a view which is made up of a subset of
columns from one or more tables. Views are an alternative
way of looking at the data in one or more tables. You
define a SQL query for each view.
Create Triggers Creates a trigger that is a special form of stored procedure
that goes into effect when you insert, delete, or update a
specified table or column. Use triggers to enforce
referential integrity.
Create Tablespace Creates tablespace to indicate the physical location of table
and index objects in the database. This refers to a partition
in a database. The definition of tablespace is RDBMS-
specific.
Create Storage Creates storage to reference the named partition that stores
tables and indexes. Storage refers to a partition on a
storage device.
Create Data Type Creates a Domain to define the set of values for which a
(domain) column is valid. Domains are associated with a Data type,
length and precision, Check parameters, Business rules,
Mandatory property, and Extended attributes.

20
Translating Conceptual Data Types
PowerDesigner supports both conceptual and physical data types.
A datatype conversion occurs when the conceptual data types are translated
into physical database types. If the conceptual datatype is not supported by
the RDBMS you selected for the physical data model, PowerDesigner uses
the following section of the DEF file for the conceptual to physical model
conversion: ‘Data types translation table from PowerDesigner’s internal data
types to target database’s data types’ (AmcDataType). You can modify an
existing data type or add in one of your own by using a text editor.
The following list defines the conceptual data types and their translation
assign by the DEF file.

Translating conceptual data types

Numeric data types


Integer (I)

A Integer data type can store a 32-bit integer numbers. Depending on the
RDBMS, short and long integers can be stored in the same way. Any
precision and length can be entered for this data type in the Standard Data
Types dialog box..
Short Integer (SI)

A Short Integer data type can store a 16-bit integer numbers. This data type
can be equal to the Integer data type if a Short Integer data type is not
supported in the targeted RDBMS.
Long Integer (LI)

A Long Integer data type can store 64-bit integer numbers. This data type can
be equal to the Integer data type if the targeted RDBMS does not support the
Long Integer data.

21
Number (N)

A Number data type can store numbers with a fixed decimal point. The
length is specified in the Length field and the precision in the Precision field
of the Standard Data Types dialog box.This data type can be equal to the
Decimal data type for certain RDBMSs.
Byte (BT)

A Byte data type can store at most 256 values. If the target RDBMS does not
support this data type, a translation to the Number data type with a length of
3 is done. Depending on RDBMS data type support, it can also be translated
to the Short Integer data type.
A length can also be entered for this datatype in the Standard Data Types
dialog box..
Decimal (DC)

A Decimal data type can store numbers with a fixed decimal point. A length
is specified in the Length field of the Standard Data Types dialog box, and a
precision given in the Precision field of the Standard Data Types dialog
box.This data type can be equal to the Number data type for certain
RDBMSs.
Float (F)

A Float data type can store 32 bit floating decimal point numbers. If you
enter a length for this data type it defines the storage of the Float data type in
the RDBMS.
Short Float (SF)

A Short Float data type can store floating decimal point numbers of less than
32 bits. This data type can be equal to the Float data type if there is no Short
Float.
Long Float (LF)

A Long Float data type can store a 64 bit floating decimal point numbers
(double precision for 15 or 16 digits, depending on the RDBMS). This data
type can be equal to the Float data type if there is no Long Float in the
targeted RDBMS.

22
Money (MN)

A Money data type has its length and the precision specified in the Length
and Precision fields of the Standard Data Types dialog box.The translated
representation of money depends upon the target RDBMS. If the target
RDBMS does not support the money data type, a translation to the Number
data type is performed for the PDM generation.The default length is 8 and
the default precision is 2.
Serial (NO)

A Serial data type can store serial numbers that are incremented
automatically.The length is specified in the Length field of the Standard Data
Types dialog box and has a default value of 6. If the target RDBMS does not
support this data type, a translation to the Number data type is performed for
the PDM generation.
Boolean (BL)

A Boolean data type corresponding to two opposing values ( true/false;


yes/no; 1/0 ). If the targeted RDBMS does not support this data type, a
translation to the Number data type with a length of 1 is performed for the
PDM genreation.

Character data types


Characters (A)

A Character data type can store character strings with a fixed length specified
in the Length field of the Standard Data Types dialog box.
Variable Characters (VA)

A Variable Characters data type can store character strings with a variable
length that does not surpass the specified value in the Length field of the
Standard Data Types dialog box. The variable length allows you to ignore
certain characters such as spaces at the end of a string. This data type can be
equal to the Characters data type with a length of 255 bytes for certain
RDBMSs.

23
Long Characters (LA)

A Long Character data type can store character strings longer than 255 bytes
with a fixed length specified in the length field.This data type is target DBMS
specific.If the target DBMS does not support this data type, a translation to
the Variable Characters data type is performed for the PDM generation. For
this datatype it’s possible to enter a length.
Long Var Characters (LVA)

A Long Var Character data type can store character strings longer than 255
bytes with a variable length in the length field. The variable length allows
you to ignore certain characters such as spaces at the end of a string. This
data type is target RDBMS specific. If the target DBMS does not support this
data type, a translation to the Long Characters data type is performed for the
PDM generation. For this datatype it’s possible to enter a length in the
Standard Data Types dialog box..
Text (TXT)

A Text data type can store character strings of variable length and longer than
255 characters. It is target RDBMS specific. If the target RDBMS does not
support this data type, a translation to the Long Characters data type is
performed for the PDM generation.
Multibyte (MBT)

A Multibyte data type can store multibyte character strings with a fixed
length specified in the Length field of the Standard Data Types dialog
box.This datatype can be equal to the National character if the target
RDBMS.If the database does not support multibyte, a translation to the
Characters data type is performed for the PDM generation.
Variable Multibyte (VMBT)

A variable multibyte data type can store multibyte character strings with a
variable length that does not surpass the specified value in the Length field of
the Standard Data Types dialog box. This datatype can be equal to the
National variable character if the target database supports it. If the database
does not support VMBT, a translation to the Variable Characters data type is
performed for the PDM generation.

24
Time data types
No length or precision can be entered for these datatypes.
Date (D)

A Date data type can store date with the day, month and year format. The
Date data type is translated into the target DBMS’s date format for the PDM
generation. If the target RDBMS does not support Date, it will be translated
into a character string with a length of 8.
Time (T)

A Time data type can store time with the hour, minutes and seconds format.
The representation format equals the format of the target RDBMS. If the
target RDBMS does not support this data type, a translation to the Date data
type is performed for the PDM generation.
Date & Time (DT)

A Date & Time data type is represented in date and time format and the
format is RDBMS specific. If the target RDBMS does not support this data
type, a translation to the Date data type is performed for the PDM generation.
Timestamp (TS)

A Timestamp data type represents the system date and time and the is
RDBMS specific. If the target RDBMS does not support this data type, a
translation to the Date data type is performed for the PDM generation.

Other data types


Binary (BIN)

A Binary data type can store binary strings with a length specified in the
Length field of the Standard Data Types dialog box. This is different from
the character data type which can be “converted”. The binary data type
results in information that cannot be converted to another data type. If the
target RDBMS does not support this data type, a translation to the Text data
type is performed for the PDM genreation.

25
Long Binary (LBIN)

A Long Binary data type can store binary strings of fixed length and is target
RDBMS specific.If the target RDBMS does not support this data type, a
translation to the Binary data type is performed for the PDM genreation.
Image (PIC)

A Image data type can store images. If the target DBMS does not support this
data type, a translation to the Long Binary data type is performed for the
PDM generation.
Bitmap (BMP)

A Bitmap data type can store images in the bitmap format (.bmp).If the target
DBMS does not support this data type, a translation to the Long Binary data
type is performed for the PDM generation.
OLE (OLE)

A OLE data type can store data concerning OLE links. If the target RDBMS
does not support this data type, a translation to the Long Binary data type is
performed for the PDM generation.
Other (*)

Designates all other user defined data types.


The default data type is a character with a length of 10.
A new data type can be defined in the List of Data Types section of the .DEF
file for the chosen DBMS. At the end of this section and after the definition
of all the data types, you can add the necessary lines to define any new data
types.
For example, to define a DESCRIPTION type , you should add the following
line in the Oracle7.def ( if the target database is Oracle7 ): DESCRIPTION =
VARCHAR(20).Then you could use this data type in the CDM by selecting
the Other data type and by entering DESCRIPTION in the Code field of the
Standard Data Types dialog box.
Undefined <UNDEF>

Designates a not yet defined data type.

26
DB2 Connection using ODBC-32 bit

Overview
PowerDesigner supports the DB2/MVS and DB2 Common Server version
2.x databases. In order to establish a connection to a DB2 database you must
use an ODBC driver. You can use either the authenticated ODBC driver
provided with PowerDesigner or the proprietary driver supplied by IBM. We
recommend using the ODBC driver provided by IBM. The IBM driver –
Client Application Enabler for Windows 95 or Windows NT, will produce
the best results when you generate or reverse engine a DB2 database.
Install the IBM Database Client Application Enabler software (CAE) and
establish the appropriate ODBC link with the CLI-ODBC Administrator
program. The CAE software allows you to connect to and interact with
remote DB2 databases. The CAE Client Setup walks users through the
following:
¨ Catalog the Node (server)
¨ Catalog the Database
¨ Define an ODBC connect for the database via CLI/ODBC Administrator

Catalog Node
You must catalog each node (server) that has a database on it before you can
connect to it. Cataloging allows the client software to know the DB2 instance
on other servers.

Catalog Database
You must catalog each database that you want to connect to. Cataloging a
database defines what the database is called for the Client; it also defines
what the database is really called on the server and where it is located.

ODBC and DB2


If you are using ODBC and DB2 set the keyword
LONGDATACOMPAT=1 in the db2cli.ini file, not in the ODBC.INI

27
CLI-ODBC Administrator
Use the DB2 CLI-ODBC Administrator from the DB2 program group to add
a DB2 database as an ODBC data source. This typically is done by the
System Administrator or DBA.
To register a DB2 database as an ODBC data source, select a database form
the Catalog Database list and mark it as an ODBC Data Source. The
configuring of a database as an ODBC source makes an entry in the Registry
– HKEY_CURRENT_USER\Software\ODBC\ODBC.INI.

Binding
The CAE application that will access a DB2 database has a set of bind files
(.bnd) that must be bound to the system before you can use CAE. These files
must be bound once for each DB2 installation before you can connect using
PowerDesigner. Check with your DBA or System Administrator. They can
tell you if the bind has already been done. Binding is usually done by the
DBA or someone with SYSADM or DBADM authority.
$ For additional information related to ODBC usage reference the IBM s
“Installing and Using the DB2 Clients” manual.

28
DB2 MVS database generation
PowerDesigner supports the following for a DB2 MVS database generation:

PDM Objects Generates via script Generates via ODBC


Create database ü ü

Create Table ü ü

Create Column ü ü

Primary Key ü ü

Foreign Key ü ü

Alternate key ü ü

Null columns ü ü

Declarative integrity ü ü

User defined data type — —


Checks ü ü

Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on columns ü ü

Unique indexes ü ü

Primary indexes ü ü

Cluster indexes 1 ü ü

View ü ü

Tablespace ü ü

Storage ü ü

Stored Procedures — —
Triggers — —
Users ü ü

Index physical options ü ü

Primary key physical options — —


Function — —
Table physical option ü ü

29
PDM Objects Generates via script Generates via ODBC
Index type ü ü

Generation 1 DB2 only allows one "clustered" index on a table so you will see only
conditions footnote one "clustered" index in your list of indexes. Normally you can specify
cluster for multiple indexes on the same table in the Other Options
window.
DB2 MVS can be implemented for uppercase characters only. To
generate uppercase DDL script select the Uppercase option in the
Database Generation Options dialog box.

Reverse Engineering support for DB2 MVS databases


Create database Reverse Engineer Reverse Engineer
via script via ODBC
Create Table ü ü

Create Column ü ü

Primary Key ü ü

Foreign Key ü ü

Alternate key ü ü

Null columns ü ü

Declarative integrity ü ü

User defined data type — —


Checks ü ü

Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on columns ü ü

Unique indexes ü ü

Primary indexes ü ü

Cluster indexes ü ü

View ü ü

Tablespace ü ü

30
Create database Reverse Engineer Reverse Engineer
via script via ODBC
Storage ü ü

Stored Procedures — —
Triggers — —
Users ü ü

Index physical options ü ü

Primary key physical options — —


Functions — —
Table physical options ü ü

Index Type ü ü

DB2 Common Server 2.1.2 database generation


PowerDesigner supports the following for a DB2 Common Server 2.1.2
database generation:

PDM Objects Generates via script Generates via ODBC


Create database ü ü

Create Table ü ü

Create Column ü ü

Primary Key ü ü

Foreign Key ü ü

Alternate key ü ü

Null columns ü ü

Declarative integrity ü ü

User defined data type ü ü

Checks ü ü

Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on columns ü ü

31
PDM Objects Generates via script Generates via ODBC
Unique indexes ü ü

Primary indexes ü ü

Cluster indexes ü ü

View ü ü

Tablespace ü ü

Storage — —
Stored Procedures ü ü

Triggers ü ü

Users ü ü

Index physical options — —


Table physical options ü ü

Function — —
Primary key physical options — —

Reverse Engineering support for DB2 Common Server 2.1.2


PowerDesigner supports the following for a DB2 Common Server 2.1.2
reverse engineering:

PDM Objects Reverse Engineer via Reverse Engineer via


script ODBC
Create database — —
Create Table ü ü

Create Column ü ü

Primary Key ü ü

Foreign Key ü ü

Alternate key ü ü

Null columns ü ü

Declarative integrity ü ü

User defined data type ü ü

Checks ü ü

32
PDM Objects Reverse Engineer via Reverse Engineer via
script ODBC
Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on columns ü ü

Unique indexes ü ü

Primary indexes ü ü

Cluster indexes ü ü

View ü ü

Tablespace ü ü

Storage — —
Stored Procedures ü ü

Triggers ü ü

Users ü ü

Index physical options — —


Functions — —
Table physical options — —
Primary key physical — —
options

33
Informix 5 and 7 Connection using ODBC-32 bit
PowerDesigner uses ODBC to establish a connection with the Informix
database. PowerDesigner provides three authenticated ODBC drivers to
support Informix: 5.x, 6.x, or 7.x in the Windows 95 or Windows NT
environment.

Requirements
¨ For Informix 7, the ODBC driver is PD Informix-Connect and has a file
name of PDINF11.DLL. This driver has a version number of 3.x.
Informix Connect requires that the Informix-CLI Version 2.5 be installed
¨ For Informix 7, the ODBC driver is PD Informix 7 and has a file name
of PDINF709.DLL. This driver has a version number of 2.12.0000.
Informix 7 requires the following be installed: Informix Net 7.1 and
Informix host name or IP Address, socket number for Services file
¨ For Informix 5, the ODBC driver is PD Informix 5 and has a file name
of PDINF509.DLL. This driver has a version number of 2.12.0000.
Informix 5 requires that Informix Net 5.01 be installed. Informix host
name or IP Address, socket number for Services file and Informix Net
5.01
¨ The message file RDS.IEM and SQL.IEM must be located in the
INFORMIX subdirectory MSG
¨ The environment variable INFORMIXDIR must be set to the directory
where you have installed the INFORMIX client. For example; SET
INFORMIXDIR = c:\INFORMIX

Verifying the Informix-CLI Version 2.5 installation


Make sure that you have only one ISQLT07C.DLL in your system, and the
directory that contains this file is in your PATH.
Verify the client software: Typically Informix-CLI 2.5 will install Ilogin
Demo, Informix SetNet or SetNet32, and some help files under the Informix-
CLI program group.

Verifying the Informix Net 7 Installation


Look for the file ISQLI710.DLL. Ensure that you have only one in your
system, and the directory that contains this file is in your PATH.

34
Verify the client software: Typically Informix Net 7 will install Ilogin and
SetNet under the Informix program group.

Verifying the Informix Net 5 Installation


Look for the file ISQLI501.DLL. Ensure that you have only one in your
system, and the directory that contains this file is in your PATH.
Verify the client software: Typically Informix Net 5 will install Ilogin and
SetNet under the Informix program group.
The following diagram shows the basic software components you need to
access an Informix database.

Configuring the Informix ODBC Data Source


To connect PowerDesigner to a database, you must first have an ODBC Data
Source created using the ODBC Administrator. It should be configured for
the specific server and/or database you wish to connect to.

35
v To configure an ODBC data source:
1 Start the ODBC Administrator.

2 Click the Add button.

3 Select the ODBC driver you want to use.


For Informix 7 with Informix-CLI 2.5 installed, select PD Informix-
Connect
For Informix 7 with Net 7.x, select PD Informix 7
For Informix 5, select PD Informix 5
4 Click the Finish button.

36
Configuring the Informix ODBC Data Source
To define a ODBC data source required to select the appropriate ODBC
driver that the supports your database version. The dialog box that appears is
specific to Informix-Connect you will see the following dialog box. Under
the General tab, you will need to supply values for the Data Source Name,
database Name, and several Connection and Advanced connection
parameters.

v To define a ODBC data source:


1 Open the ODBC Administrator.
2 Click Add to configure a new data source.
3 Configure the General parameters

Field Description
Data Source Name Used to identify the data source in a list of data sources. This
name is unique to the client machine. This does not identify
the server to connect to. That is determined by other
parameters
Description An optional field that allows a user to describe the use or
purpose of this particular data source
Database Name The name of the database on the Informix server that will be
the default database for any connection made through this
data source

37
4 Select the Connection tab, and configure the detailed database
connection parameters:

Field Description
Database List This is an optional parameter. If you do not supply a database
name, you may supply several names in this list, separated by
commas. This list will be a drop-down list box where you choose
a database from the list at connection time. If you supplied a
database name in the previous screen, it will override the list
Default User This is an optional field that may contain the user name to use by
Name default. It will appear in the user field at connection time
Host Name The machine that the Informix server is running on. This should
be the actual computer name
Service Name The service entry in the service file that identifies the TCP port
number being used by the Informix server. This represents the
Informix instance to connect to on the host machine
Server Name The name of the server in the SQL Hosts file. This is the server
alias that identifies the Informix server
Protocol Type The protocol for connecting to the Informix Server. For Informix
On Line servers using TCP/IP, it would be onsoctcp. For standard
engine, it would be sesoctcp
Use Default This checkbox, if selected, will have the default login from the
Login Informix registry (Configured in the Informix-CLI SetNet utility)
used for the connection

5 Click OK to save the Data Source


6 Click OK to close the ODBC Administrator.

38
Configuring an INFORMIX CLI-2.5, PD Informix 7, or PD Informix 5
ODBC Data Source
Select the appropriate INFORMIX-CLI 2.5, PD Informix 7, PD Informix 5
driver. The following dialog box will appear where you need to supply values
for the Data Source Name, Database Name, and several Connection and
Advanced connection parameters.
The setup for all three of these ODBC drivers will be identical.

Configuring the basic connection parameters


Parameters in the Driver Setup dialog box are the following:

Field Description
Data Source A user-supplied name used to identify the data source in a list of
Name data sources. This name is unique to the client machine. This does
not identify the server to connect to. That is determined by other
parameters
Description An optional field that allows a user to describe in better detail the
use or purpose of this particular data source
Database The name of the database on the Informix server that will be the
Name default database for any connection made through this data source

39
Configuring detailed database connection parameters
Select the Advanced button, and configure the detailed database connection
parameters:

Field Description
Database List This is an optional parameter. If you do not supply a database
name, you may supply several names in this list, separated by
commas. This list will be a drop-down list box where you choose
a database from the list at connection time. If you supplied a
database name in the previous screen, it will override the list
Default User This is an optional field that may contain the user name to use by
Name default. It will appear in the user field at connection time
Host Name The machine that the Informix server is running on. This should
be the actual computer name
Service Name The service entry in the services file that identifies the TCP port
number being used by the Informix server. This represents the
Informix instance to connect to on the host machine
Protocol Type The protocol for connecting to the Informix Server. For Informix
OnLine servers using TCP/IP, it would be onsoctcp. For standard
engine, it would be sesoctcp

40
The following parameters may be left as their default values, as shown in the
screen shot above.
Yield Proc
Cursor Behavior
Enable Scrollable Cursors
Get DB List From Informix
$ For details on what these parameters are please consult the on-line help
by pressing the Help button.

41
Informix 7 Database Generation
PowerDesigner generates the following for an Informix database:

PDM object Generates via script Generates via ODBC


Create database ü —
Create Table ü ü
Create Column ü ü

Primary Key ü ü

Foreign Key ü ü

Alternate key ü ü

Declarative integrity ü ü

Table physical options ü ü

Checks ü ü

Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on columns ü ü

Unique indexes ü ü

Cluster indexes ü ü

View 1 ü ü

Tablespace — —
Storage — —
Stored Procedures ü ü

Triggers ü ü

Index physical options ü ü

Functions ü ü

Primary key physical — —


options
Users ü ü

Generation 1 Views are supported with version 6.1 of PowerDesigner.


conditions footnote
42
Reverse Engineering of an Informix Database
PowerDesigner reverse engineers the following for an Informix database:

PDM object Reverse Engineer Reverse Engineer


via script via ODBC
Create database — —
Create Table ü ü

Create Column ü ü

Primary Key ü ü

Foreign Key ü ü

Alternate key ü ü

Declarative integrity ü ü

Null columns ü ü

Checks ü ü

Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on columns ü ü

Unique indexes ü ü

Primary indexes ü ü

Cluster indexes ü ü

View ü ü

Tablespace — —
Storage — —
Stored Procedures ü ü

Triggers ü ü

Function ü ü

Users ü ü

43
Microsoft Access 95 & Access 97 Connection-32
bit

Overview
Because Microsoft Access is a NON-SQL database you must be aware of
certain conditions when forward and reverse engineering this database.
Forward Engineering with PowerDesigner has the following considerations:
¨ DDL Script generated with the ‘ODBC syntax’ option off will use the
DEF file. This produces a script that will be in SQL format. The results
of this type of generation do not produce optimum results from
PowerDesigner
¨ DDL Script generation with the ‘ODBC syntax’ option on will use the
DBC file. The output of this generation will be in BASIC
¨ Script files are produced in 64 K bytes increments. Larger model might
produce more than more script file and these file will have a .Dot
extension
The following diagram shows the basic software components required for
Microsoft Access database access in PowerDesigner.

Reverse Engineering of an Access database


You can reverse engineer an Access database via ODBC or via script.

44
Reverse Engineering via ODBC
This does not product the capture as many database object as it does when
you perform the reverse engineering using the script file provided by
PowerDesigner.

Reverse Engineering Via Script


You should be done using the appropriate Accrev.bas file. The Basic script
allows you to generate an ANSI SQL script for an Access database. At the
initial installation of PowerDesigner these script files are placed by default in
the PWRS\Pd6\tools\ directory.
¨ There are three files associated with Access supplied by PowerDesigner:
Accrev.bas - Access 1.0 and 1.1 databases
Accrev2.bas - Access 2.0 database
Accrev95.bas – Access 95 & Access 97databases
¨ The Accrev.bas program walks you through the necessary steps to
reverse engineer a database:
Start the appropriate version of Microsoft Access
Open the existing database
Create a new Module
Delete lines generated by default for the new module
Choose the ‘File’ option form the "Insert" menu
Enter the file name: accrev95.bas
Click on the "Ok" button
Choose the "Debug Window" option from the "View"
Type reverse

Configuring Data Source

v To configure an Access data source:


1 Start the ODBC Administrator.
2 Click Add to configure a new data source. A list of installed drivers
appears. This list is populated from by the ODBC Drivers for Windows
95 or Windows NT installation and by third party drivers that you have
installed on your system. ODBC driver installation is performed
separately from the PowerDesigner installation.
3 Select the Microsoft Access ODBC driver and click OK.

45
4 This will select the ODBCJT32.DLL file in the Windows 95 System or
the Windows NT System32 directory.
5 Specify the values for the data source as follows:

Field Description
Data Source Name The string identifying the data source name
Description An optional long description of the data source name

All other settings are optional or left as defaults, for information check the
driver’s Help file.

46
Microsoft Access Database
PowerDesigner generates the following for a Microsoft Access database:

PDM object Generates via script Generates via ODBC


Create database 1 ü —
Create Table 2 ü ü

Create Column ü ü

Primary Key — —
Foreign Key — —
Alternate key ü ü

Declarative integrity ü —
NOTNULL columns 3,4 ü ü

Null columns 3,4 ü ü

Checks ü ü

Minimum value ü —
Maximum value ü —
Default value ü —
Validation rule on columns ü —
Unique indexes ü ü

Primary indexes ü ü

Cluster indexes ü —
View ü ü

Tablespace — —
Storage — —
Stored Procedures — —
Triggers — —
Function — —
Users — —

Generation 1 Microsoft Access has a limitation on processing a database script larger


conditions than 64K. Access can not read the script and will produce a script error
footnotes of “module exceed 64K”.

47
2 Microsoft Access does not support the Drop Table option when
generating a database because it does not support “if exists() then”
statements. This limitation results in no way to test if a table already
exists in the Microsoft Access database. To work around this limitation a
user must first use the Archive database command then the Modify
database command when adding new tables to an existing database.
3 PowerDesigner support the definition of mandatory and non-mandatory
fields. However it does not currently support the definition of “Allow
Zero Length” fields for MS Access.
4 The Microsoft Access ODBC driver does not support the NULL or NOT
NULL constraint. If you want to obtain the mandatory option on a
column you should use the database script generation.

Microsoft Access Reverse Engineering


PowerDesigner reverse engineers the following from a Microsoft Access
database:

PDM object Reverse Engineer Reverse Engineer


via script via ODBC
Create database — —
1
Create Table ü ü
1
Create Column ü ü
1
Primary Key ü ü
1
Foreign Key ü —
1
Alternate key — —
Declarative integrity ü —
1
NOTNULL columns ü ü
1
Null columns ü ü
Checks 1 ü —
Minimum value 1 ü —
Maximum value 1 ü —
Default value 1 ü —
Validation rule on columns 1 ü —
Unique indexes 1 ü ü

48
PDM object Reverse Engineer Reverse Engineer
via script via ODBC
Primary indexes 1 ü ü

Cluster indexes 1 ü —
View 1 ü —
Tablespace — —
Storage — —
Stored Procedures — —
Triggers — —
Users — —

Reverse 1 PowerDesigner supplies a script file that should be used when you are
Engineering Reverse Engineering an MS Access database. There are several versions
conditions footnote of the ACCREV. BAS files in the PD6\tools directory.
Use the appropriate ACCREVxx. BAS file to Reverse Engineer your
Microsoft Access database to obtain comments, business rules,
minimum, maximum and default values.

49
Microsoft SQL Server Connection using
ODBC-32 bit

Overview
PowerDesigner uses ODBC to establish a connection with the Microsoft SQL
Server database.
PowerDesigner If you are working with PowerDesigner MetaWorks version 6 or earlier, you
Version 6 or earlier should install both the Microsoft SQL Server proprietary ODBC driver and
the authenticated Microsoft SQL Server ODBC driver provided by
PowerDesigner. For optimum results when working with the PowerDesigner
MetaWorks repository the Microsoft SQL Server ODBC driver is required to
consolidate models into the MetaWorks repository and the PowerDesigner
ODBC is required to extract models from the MetaWorks repository. The
PowerDesigner ODBC driver for Microsoft SQL Server has a file name of
PDSS611.DLL and a version number of 3.x.
PowerDesigner If you are working with PowerDesigner MetaWorks version 6.1, you need
Version 6.1 only to install the Microsoft SQL Server ODBC driver. This driver will both
consolidate and extract models from the MetaWorks repository.

Requirements
In order to establish a connection between PowerDesigner and Microsoft
SQL Server databases you must have the Microsoft SQL Server DB-Library
and Net-Library version installed on your system. You will need to connect
your Microsoft SQL Server vendor to obtain the appropriate DB-Library and
Net-Library software for your environment.
DB-Library The DB-Library needs the NTWDBLIB.DLL in the Windows 95 System or
Windows NT directory. The path of DB-Library must be defined in the
PATH variable. You also need the following variables defined in your
environment: ISLVINI, LIBPATH, and VCSID.
Net-Library The version of Net-Library required depends on the network protocol you are
using to connect to the SQL Server. Named Pipes requires
DBNMPNTW.DLL
TCP/IP requires DBMSSOCN.DLL

50
You must have a copy of NTWDBLIB.DLL on your path or in the Windows
95 SYSTEM or Windows NT SYSTEM32 directory, a error message
appears.
The following diagram shows the basic software components required to
access a Microsoft SQL Server database.

Configuring Data Source

v To configure a Microsoft SQL Server data source:


1 Start the ODBC Administrator.
2 Click Add to configure a new data source.
A list of installed drivers appears. This list is populated from your
selections on the ODBC Drivers for Windows 95 or Windows NT
installation. The ODBC Drivers for Windows 95 or Windows NT
installation must be performed separately from the PowerDesigner
product installation.

51
3 Select the Microsoft SQL Server driver of your choice and click OK.

This will install the PDSS611.DLL file in the Windows 95 System


directory or the Windows NT System32 directory.
If you are configuring an existing data source, select the data source
name and click FINISH. The setup dialog box appears.

52
Field Description
Data Source The string identifying this SQL Server data source configuration
Name in the system information
Description An optional long description of the data source name
Server Name The name of the server that contains the SQL Server tables you
want to access
Database The name of the database to which you want to connect by default.
Name If you do not supply a specific value, the connection will be made
to a default database defined by SQL Server

All other settings are optional or left as defaults, for more information check
the driver’s HELP file.

Microsoft SQL Server Database


PowerDesigner generates the following for a Microsoft SQL Server database:

PDM object Generates via script Generates via ODBC


Create database ü —
Create Table ü ü

Create Column ü ü

Primary Key ü ü

Foreign Key ü ü

User defined data type ü ü

NOTNULL columns ü ü

Null columns ü ü

Declarative integrity 1 ü ü

Checks ü ü

Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on columns ü ü

Alternate key ü ü

Unique indexes ü ü

53
PDM object Generates via script Generates via ODBC
Primary indexes ü ü

Cluster indexes ü ü

View ü ü

Tablespace — —
Storage ü ü

Stored Procedures ü ü

Function — —
Triggers ü ü

Table physical options ü ü

Index physical options ü ü

Primary key physical ü ü


options
User ü ü

Identity ü ü

Generation 1 MS SQL Server 6.x only supports a restrict/restrict option for


conditions footnote Declarative Referential Integrity. Users can change references to
restrict/restrict or to use triggers to generate Referential Integrity. This
will take care of the following warning message: "To solve the conflict
between Foreign Keys and Triggers, only triggers will be generated for
Reference xxxx." The FK constraints are then not generated.

Reverse Engineering
PowerDesigner Reverse Engineering a Microsoft SQL Server database:

PDM object Reverse Engineer Reverse Engineer via


via script ODBC
Create database — —
Create Table ü ü

Create Column ü ü

Primary Key ü ü

Foreign Key ü ü

54
PDM object Reverse Engineer Reverse Engineer via
via script ODBC
User defined data type ü ü

NOTNULL columns ü ü

Null columns ü ü

Declarative integrity ü ü

Checks ü ü

Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on columns ü ü

Alternate key ü ü

Unique indexes ü ü

Primary indexes ü ü

Cluster indexes ü ü

View ü ü

Tablespace — —
Storage ü ü

Stored Procedures ü ü

Function — —
Triggers ü ü

Table physical options ü ü

Index physical options ü ü

Primary key physical options ü ü

User ü ü

Identity ü ü

55
Oracle 8 Connection using ODBC-32 bit

Overview
PowerDesigner uses ODBC to establish a connection with the Oracle
database. An authenticated Oracle ODBC driver is provided by
PowerDesigner. It has a file name of PDOR711.DLL and a version number
of 3.x.

Requirements
Before you can attempt to connect to an Oracle database you must have the
Oracle Networking Products installed in your environment. The following
elements are required:
¨ SQL *Net 2.3 client installation provides the following files, which are
needed by the ODBC driver: ORA73.DLL, CORE35.DLL,
NLSRTL32.DLL, CORE350.DLL, and OCIW32.DLL. If you attempt to
configure an Oracle 7 data source and do not have these DLLs on your
path or in the appropriate system directory you will receive error
messages
¨ An Oracle server name entry in the tnsnames.ora file

56
Accessing an Oracle database
The following diagram shows the basic software components required to
access an ORACLE7 database from PowerDesigner.

Configuring an Oracle ODBC Data Source

v To configure an Oracle data source:


1 Start the ODBC Administrator.
2 Click Add to configure a new data source.
A list of installed drivers appears. This list is populated from your
selections on the ODBC Drivers for Windows installation. The ODBC
Drivers for Windows installation must be performed separately from the
PowerDesigner product installation.

57
3 Select the Oracle driver of your choice and click OK.
4 The PowerDesigner ODBC Driver has a file name of PDOR711.DLL.
5 If you are configuring an existing data source, select the data source
name and click FINISH. The setup dialog box appears.

58
6 Specify the values for the data source as follows:

Field Description
Data Source The string identifying this Oracle data source
Name configuration in the ODBC.INI section of your registry
Description This is an optional long description of the data source
name
Server Name The SQL*NET connection string designating the server
and the database to be accessed. This information
depends on the version of SQL*NET driver you are
using. The server name specified here must match the
entry in your tnsname.ora file. This file is the SQL*NET
Configuration file generated by the SQL*Net Easy
Configuration. The tnsnames.ora file typically resides in
the c:\orawin95\network\admin\ directory

59
The following values are optional:

Value Description
Server List The list of SQL*NET connection strings that will appear
in the logon dialog box. This string needs to be separated
with commas. You must enclose the SQL*Net
connection string in quotation marks if it contains a
comma
Default User The default user name used to connect to your Oracle
Name database. This field is required if security is enabled on
your database
Lock Time Out Acceptable values are 0 or -1 they specify whether or not
Oracle should wait for a lock to be freed before raising
an error when processing a Select…For Update
statement. Possible values are -1 (wait forever) or 0
(don’t wait). The default is -1
Array Size The number of bytes the driver uses for fetching multiple
rows. Valid values are between 0 and 65536; the default
is 60000
Catalog Select this box to retrieve the contents of the
Comments COMMENTS columns for the catalog function.
Retrieving the COMMENTS columns will slow
performance of your data catalog operations
Translate Select to perform a translation of your data from one
character set to another. When the Select Translator
dialog box appears you can select the translator to
perform the translation. The translators listed in the
dialog box are those listed in the ODBC Translator
section of your odbcinst.ini file

60
Oracle 8 Database
PowerDesigner generates the following for an Oracle 8 database:

PDM object Generates via script Generates via ODBC


Create database ü —
Create Table ü ü

Create Column ü ü

Primary Key ü ü

Foreign Key ü ü

Alternate key ü ü

NOTNULL columns ü ü

Null columns ü ü

Declarative integrity 1 ü ü

Checks ü ü

Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on columns ü ü

Unique indexes ü ü

Primary indexes ü ü

Cluster indexes ü ü

View ü ü

Tablespace ü ü

Storage ü ü

Stored Procedures ü ü

Function ü ü

Triggers ü ü

Table physical options ü ü

Index physical options ü ü

Primary key physical options ü ü

User ü ü

61
Generation 1 Oracle does not support Referential Integrity defined as an Update
conditions footnote 'Cascade'. In Oracle this must be defined as a trigger. If you selected
Cascade for the Update constraint on the referential integrity and then
run Check Model you will obtain the following error:
“To solve the conflict between foreign key and triggers, only triggers
will be generated for reference ...”. Oracle does not support Cascade for
the declarative definition (the declarative definition means the definition
of the FK), so the trigger will always generate the Cascade

Oracle 8 Reverse Engineering


PowerDesigner Reverse Engineers a Oracle 8 database:

PDM object Reverse Engineer via Reverse Engineer via


script ODBC
Create database — —
Create Table ü ü

Create Column ü ü

Primary Key ü ü

Foreign Key ü ü

Alternate key ü ü

NOTNULL columns ü ü

Null columns ü ü

Declarative integrity ü ü

Checks ü ü

Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on ü ü
columns
Unique indexes ü ü

Primary indexes ü ü

Cluster indexes — —

62
PDM object Reverse Engineer via Reverse Engineer via
script ODBC
View ü ü

Tablespace ü ü

Storage ü ü

Stored Procedures 1 ü ü

Function ü ü

Triggers ü ü

Table physical options ü ü

Index physical options ü ü

Primary key physical — —


options
User ü ü

Reverse 1 Oracle database that uses the Package Body and Package Specification
Engineering features, PowerDesigner will reverse engineer the packages and the
conditions footnote bodies both as Stored Procedures, and give them the same Stored
Procedure name.

63
Sybase SQL Anywhere 5.x Connection using
ODBC-32 bit

Overview
PowerDesigner uses ODBC to connect to a Sybase SQL Anywhere database.
PowerDesigner provides an authenticated ODBC driver to support Sybase
SQL Anywhere 5.x. It has a file name of WOD50T.DLL.

Requirements
The client and server software can be obtained from the following Sybase
tools:
¨ PowerBuilder includes a Sybase SQL Anywhere standalone database
engine
¨ PowerDesigner AppModeler module includes a Sybase SQL Anywhere
engine and Net Impact Dynamo
¨ PowerDesigner MetaWorks provides an authenticated Sybase SQL
Anywhere server (used for the data dictionary) plus client

64
The following diagram shows the basic software components needed to
connect to a Sybase SQL Anywhere database.

Creating the ODBC Data Source

v To configure an ODBC data source:


1 Start the ODBC Administrator.
2 Click Add to configure a new data source

65
3 Selected the Sybase SQL Anywhere driver from the list and click Finish.

4 Specify the values for the data source as follows:

66
Field Description
Data Source String identifying this Sybase SQL Anywhere data source
Name
Description This is an optional long description of the data source
User ID Optional name to be used when connecting. If the user ID is
omitted, most applications prompt you for a user ID and
password when connecting to the data source
Password Optional password the supplied User ID. Since the password
supplied is stored in ODBC.INI, setting the password here
may be a security risk. If the password is omitted, most
applications prompt you to enter your password when
connecting to the data source
Server Name The name of a SQL Anywhere database engine or server. If
not specified, the default engine is used. This field
corresponds to the EngineName connection parameter
Database Name Corresponds to the name of a database already running on a
SQL Anywhere database engine or SQL Anywhere network
server. This field corresponds to the DatabaseName
connection parameter
Database Startup The command used to run the database software when the
named database engine or server is not already executing.
You can select Local or Network, as appropriate, if the
default settings are satisfactory. Otherwise, select Custom
and enter the command including any command line
parameters by pressing the Options button

Generation of Sybase SQL Anywhere 5.x database


PowerDesigner generates the following for a Sybase SQL Anywhere 5.x
database:

PDM object Generates via script Generates via ODBC


Create database ü —
Create Table ü ü

Create Column ü ü

Primary Key ü ü

Foreign Key ü ü

NOTNULL columns ü ü

67
PDM object Generates via script Generates via ODBC
Null columns ü ü

Declarative integrity 7 ü ü

Checks 6 ü ü

Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on columns ü ü

Alternate key ü ü

Unique indexes 1, 2, 3, 5 ü ü

Primary indexes 1, 2, 3, 5 ü ü

Cluster indexes 1, 2, 3, 5 ü ü

View 4 ü ü

Tablespace ü ü

Storage — —
Stored Procedures ü ü

Function ü ü

Triggers ü ü

Table physical options ü ü

Index physical options ü ü

Primary key physical — —


options
User ü ü

Generation 1 SQL Anywhere automatically creates indexes for primary keys and for
conditions unique constraints. These automatically-created indexes are held in the
footnotes same database file as the table.
2 You can place the index in a separate database file by specifying a
dbspace name in which to put the index. This feature is of use mainly for
large databases, to circumvent the limit of 2 GB per table.
3 Index ownership - There is no way of specifying the index owner in the
CREATE INDEX statement. Indexes are automatically owned by the
owner of the table on which they are defined. The index name must be
unique for each owner.

68
4 Indexes cannot be created for views.
5 The name of each index must be unique for a given table. For databases
created previous to release 5.5.01, the condition was more restrictive:
that each index name must be unique for a given user ID.
6 You can attach CHECK conditions to user-defined data types, and
columns defined on those data types inherit the CHECK conditions. A
CHECK condition explicitly specified for the column overrides that from
the user-defined data type.
7 Referential integrity actions are implemented using system triggers. The
trigger is defined on the primary table, and is executed using the
permissions of the owner of the primary table.

Transact SQL Use the Sybase Compatible Transact SQL target database to generate or
reverse transact SQL.

Reverse Engineering a Sybase SQL Anywhere 5.x database


PDM object Reverse Engineer Reverse Engineer
via script via ODBC
Create database — —
Create Table ü ü

Create Column ü ü

Primary Key ü ü

Foreign Key ü ü

NOTNULL columns ü ü

Null columns ü ü

Declarative integrity ü ü

Checks ü ü

Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on columns ü ü

Alternate key ü ü

Unique indexes ü ü

Primary indexes ü ü

69
PDM object Reverse Engineer Reverse Engineer
via script via ODBC
Cluster indexes ü ü

View ü ü

Tablespace ü ü

Storage — —
Stored Procedures ü ü

Function ü ü

Triggers ü ü

Table physical options ü —


Index physical options ü —
Primary key physical options — —
User ü ü

Use the Sybase Compatible transact SQL target database to reverse engineer
Transact SQL.

70
Sybase SQL Server System 10 and System 11
ODBC Connection-32 bit

Overview
PowerDesigner uses ODBC to establish a connection with the Sybase SQL
Server database. The Sybase ODBC driver provided by PowerDesigner 6 has
a file name of PDSYB11.DLL and a version number of 3.x. The Sybase
ODBC driver provided by PowerDesigner is produced by Intersolv, Inc..

Requirements
But before the to connect to Sybase from PowerDesigner you must have the
Sybase Open Client Library and the appropriate Sybase Net-Library installed
on your system. These programs must be installed before you can gain access
to the Sybase server. Check that the following primary files are present:
Libcs.DLL, Libcomm.DLL, and Libintl.DLL.
¨ Platform of Open/Client 32 bit 10.0.3 version or higher
¨ Set the environment variable SYBASE to the directory where you have
installed the Client. For example, SET SYBASE = C:\SQL10 or SET
SYBASE = C:\SQL11
¨ Server Name, Database Name, Network library driver (DLL), server’s
port number, Node, or, socket number
¨ Set the Connection Service Entry in SQL Edit per the Net-library driver.
For example: query = nlwnsck, Server Name, port number OR go into
the Interfaces driver with DS Edit and modify the attributes

Testing the Connection


Sybase provides a utility called SYBPING that tests connectivity from your
client workstation to the database server. Servers were previously added
through DSEdit, which is a tool that allows you to define servers and add
them to the SQL.INI.

71
The following diagram shows the basic software components required to
access a Sybase SQL Server System 10 or System 11 database in
PowerDesigner.

Configuring Data Source

v To configure a Sybase 10 or 11 data source:


1 Start the ODBC Administrator.
2 Click Add to configure a new data source.
A list of installed drivers appears. This list is populated from your
selections on the ODBC Drivers for Windows 95 or Windows NT
installation. The ODBC Drivers for Windows 95 or Windows NT
installation must be performed separately from the PowerDesigner
product installation.

72
3 Select the Sybase driver and click OK.

This will install the PDSYB11.DLL file in the Windows 95\System


directory or the Windows NT\System32 directory.
If you are configuring an existing data source, select the data source
name and click FINISH. The setup dialog box appears.
4 Specify the values for the data source as follows:

Field Description
Data Source The string identifying this Sybase data source
Name configuration in the ODBC.INI file
Description An optional long description of the data source name
Server Name The name of the server that contains the System 10 or
System 11 tables you want to access. If you do not
specify a server name, the server name in the
DSQUERY environment variable is used. The name
defined here must match the entry in your SQL.INI file
Database Name The name of the database to which you want to connect
by default. If you do not supply a specific value, the
connection will be made to a default database set by the
DBA

73
All other settings are optional or left as defaults, for more information
check the driver’s HELP file.

74
Sybase SQL Server 11 database

Generating a Sybase SQL Server 11 database


PowerDesigner generates the following for a Sybase SQL Server 11
database:

PDM object Generates via Generates via


script ODBC
Create database ü —
Create Table ü ü

Create Column ü ü

Primary Key 1,2 ü ü

Foreign Key 3 ü ü

User defined datatype ü ü

NOTNULL columns ü ü

Null columns ü ü

Declarative integrity 4 ü ü

Checks ü ü

Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on columns ü ü

Alternate key ü ü

SP Primary Key 1, 2 ü ü

SP Foreign Key 3 ü ü

Unique indexes ü ü

Primary indexes ü ü

Cluster indexes ü ü

View ü ü

Tablespace — —
Storage ü ü

75
PDM object Generates via Generates via
script ODBC
Stored Procedures ü ü

Function — —
Triggers ü ü

Table physical options ü ü

Index physical options ü ü

Primary key physical options ü ü

User ü ü

Identity ü ü

Generation 1 The PowerDesigner Sybase DEF file controls whether the generation
conditions will build primary key and foreign key constraints or use sp_primarykey
footnotes or sp_foreighkey to identify keys, leaving the unique restriction and
referential integrity up to indexes and triggers. To generate both Primary
Keys and Primary Key Index at the same time the PKAutoIndex variable
must be changed in the DEF file.
cd#Primary key is auto-indexed. YES/NO
PKAutoIndex = NO
2 Modify the DEF file to change primary key generation for Constraints to
sp_primarykey. Find the UseSpPrimKey variable and change its value to
YES
# Use the sp_primarykey command to generate primary key
UseSpPrimKey = YES

3 Modify the DEF file to change the generation of constraints to


sp_foreignkey. Find the UseSpFornKey variable and change its value to
YES
# Use the sp_foreignkey command to generate foreign key
UseSpFornKey = YES

4 It's possible to create an entirely optional relation which does not create
any update/insert/delete triggers – it just use the relation for reads.

76
Reverse Engineering a Sybase SQL Server 11 database
PowerDesigner Reverse Engineers the following for a Sybase SQL Server 11
database:

PDM object Reverse Engineer Reverse Engineer


via script via ODBC
Create database — —
Create Table ü ü

Create Column ü ü

Primary Key ü ü

Foreign Key ü ü

Alternate key ü ü

SP Primary Key ü ü

SP Foreign Key ü ü

User defined datatype ü ü

NOTNULL columns ü ü

Null columns ü ü

Declarative integrity ü ü

Checks ü ü

Minimum value ü ü

Maximum value ü ü

Default value ü ü

Validation rule on columns ü ü

Unique indexes ü ü

Primary indexes ü ü

Cluster indexes ü ü

View ü ü

Tablespace — —
Storage ü ü

Stored Procedures ü ü

Function — —

77
PDM object Reverse Engineer Reverse Engineer
via script via ODBC
Triggers ü ü

Table physical options — —


Index physical options ü ü

Primary key physical options ü ü

User ü ü

Identity ü ü

78

You might also like