Prev Next

Import Database Schema

The power of model-based engineering is the ability to visualize, analyze and design all aspects of a system. Being able to view the database schemas alongside other models of a system provides great clarity and reduces the chance of error. Enterprise Architect can reverse engineer a DBMS schema and its objects into a model under a number of different standards, including UML, Information Engineering and IDEF 1X. A wide range of database objects are supported including Tables, Views, Procedures, Functions and Sequences. Enterprise Architect communicates with the DBMS via ODBC, can import a schema via this connection, and can synchronize the model with the live database if it is changed.

Once the schema is in Enterprise Architect, the database objects can be traced to other elements, ensuring the integrity of design and architecture. When systems target multiple DBMSs, these can all be reverse engineered into a model and elements and datatypes can be compared between these models. The sophisticated reporting engine can produce high quality documentation, including data dictionaries, diagrams and relationships back to other models such as architecture and information requirements, and ultimately to business goals and drivers.

Database schema information can be imported via the Database Builder or from the 'Code' ribbon.

Import Database Schema

Step

Action

See also

1

Open the Database Builder.

The Database Builder

2

Load or create a Data Model.

3

  • Right-click on the loaded Data Model in the Database Builder and select 'Import DB schema from ODBC'  or
  • From the ribbon select 'Code > Schema > DDL > Import a DB Schema'

The 'Import DB Schema from ODBC source' dialog displays, showing the details of the current active database connection.

The Import DB Schema from ODBC Source dialog

Option

Description

See also

Database

This field shows a description of the current ODBC connection, in the format:

     dbms.database_server.database_name

If necessary, click on the button and, on the 'Machine Data Source' tab of the 'ODBC Select Data Source' dialog, select an alternative ODBC connection.

Import to

This field shows the target Package that the new objects will be saved to.

If you want to specify a different Package, click on the button and select an alternative Package.

Only include objects from Schema(s)

If the database type supports multiple schemas (such as SQL Server, Oracle, PostgreSQL and DB2 Express) you can filter objects to be retrieved from the database by schema.

The available schemas are automatically listed in this panel. Select the checkbox against each schema to include in the import.

(You can click on the All button to select all the schemas, or the None button to clear all selected checkboxes.)

If you suspect that the schema list might have changed since you loaded them, you can refresh the list by clicking on the Reload Schemas button.

Filter Options

The 'Filter Options' panel controls what object types and properties are read in from the database schema. Values changed on this screen are saved to the registry so that they are re-applied in the next work session. The available options are briefly described here; select the checkbox against an option to activate it.

Tables

  • Tables - Select to import Tables
  • Primary Keys - Select to import Primary Key definitions on Tables
  • Foreign Keys - Select to import Foreign Key definitions on Tables
  • Indexes - Select to import Table Indexes
  • Unique Constraints - Select to import Unique Constraint definitions on Tables
  • Check Constraints - Select to import Check Constraint definitions on Tables
  • Table Triggers - Select to import Trigger definitions on Tables
  • Table Properties - Select to import extended Table properties
  • Length Semantics - Select to import length semantic definitions on Oracle string columns

Objects

  • Views - Select to import Views
  • Procedures - Select to import Procedures
         - As Operations - Select to import Procedures as operations (methods) of a single Class; you can
           view and edit them through the Database object container 'Properties' dialog (the option defaults
           to unselected, where the selected items are imported as separate Classes)
  • Functions - Select to import Functions
         - As Operations - Select to import Functions as operations (defaults to unselected)
  • Sequences - Select to import Sequences
         - As Operations - Select to import Sequences as operations (defaults to unselected)
  • Package - Select to import Oracle Packages

Advanced

  • System Objects - Select to import system Tables, Views and other system objects

Warning: With the 'As Operations' option for Procedures, Functions and Sequences, if objects have been imported under one setting (selected or unselected) and then you change the setting and import further objects, the objects imported under the first setting are removed.

Database Procedures Database Functions Foreign Keys Indexes Unique Constraints Check Constraints Primary Keys Database Sequences Database Tables Database Views Table Triggers Oracle Packages

Synchronization

Select the appropriate radio button to indicate whether the existing Classes are to be updated, or the database objects imported as new objects.

If you select the 'Synchronize existing classes' option, also select the appropriate checkboxes to determine whether model comments, column default values and/or Table constraints are to be retained or overwritten with the comments, values and constraints of the imported objects.

Import To

Select the appropriate radio button to indicate whether to update the Package and currently-open data model diagrams, or just the Package.

If no diagrams are open, the 'Package Only' radio button defaults to selected and the options are disabled; if the open diagrams are in the selected Package, you can select either option.

Import

Click on this button to start the import.

The 'Select Database Objects to Import' dialog displays, listing all the database objects found that match the selection criteria.

Select the checkbox against each schema (or object type) to automatically select all objects in that group or to import each object individually.

Click on the All button to select all types and objects, or on the None button to clear all selected checkboxes.

When you have selected all the objects to import, click on the OK button to continue the import.

Notes

  • Enterprise Architect requires 32-bit ODBC drivers to connect to a repository through ODBC; to set up the ODBC configuration on 64-bit clients, run the 32-bit ODBC Data Source Administrator from C:\Windows\SysWOW64\odbcad32.exe
  • The ODBC connection should use the ODBC driver available from the DBMS vendor, such as MySQL's ODBC driver for MySQL, and Oracle's ODBC driver for Oracle; drivers provided by third-party vendors are not supported, including the Microsoft ODBC driver for Oracle
  • You can import a suitable ODBC driver for SQLite from http://www.ch-werner.de/sqliteodbc/
  • Due to the limitations of SQLite, round tripping of SQLite Table and column comments is not possible; to retain comments entered in an SQLite data model when importing from ODBC, deselect the 'Overwrite Object Comments' checkbox in the 'Synchronization' section of the 'Import DB Schema from ODBC Source' dialog
  • If setting up an ODBC connection for reverse engineering, the default settings are sufficient
  • If you are importing database schema from an MS Access Jet 4.0 database, check that you have selected the 'Use Jet 4.0' checkbox on the 'General' page of the 'Preferences' dialog (the 'Start > View > Preferences' ribbon option), otherwise the Jet 3.5 routines are loaded; you must restart Enterprise Architect after selecting the checkbox
  • The list of Data Modeling Data types is defined as static data (in each repository), so depending on the age of your repository, there could be additional data types available from the 'Data Modeling Data Types' section of the 'Resources' page on the Sparx Systems website

Learn more