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 achieves this by interrogating the DBMS's information schema and importing the definition into a UML objects. As modifications are made to the Live database the changes can be synchronized into the model.
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 (recommended) or from the 'Develop' ribbon.
Import Database Schema
Step |
Action |
See also |
---|---|---|
1 |
Open the Database Builder (Develop > Data Modeling > Database Builder) |
The Database Builder |
2 |
Load or create a Data Model. |
|
3 |
The 'Import DB Schema' dialog displays, showing the details of the current active database connection. |
The Import DB Schema dialog
Option |
Description |
See also |
---|---|---|
Database |
This field shows a description of the current Live connection, in the format: dbms.database_server.database_name If necessary, click on the button and, select an alternative 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 to select all the schemas, or the 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 . |
|
Name Filter |
The 'Name :' field allows filtering of objects using SQL wildcards appropriate to the DBMS of the schema being imported. For example, for Oracle:
Note that only one filter can be entered. You cannot add a second filter using the AND clause. Filtering is not available for MS Access |
|
Filter Options |
The ' 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
Objects
Advanced
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 Database 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 to select all types and objects, or on the to clear all selected checkboxes. When you have selected all the objects to import, click on the to continue the import. |
Notes
- Within Windows, ODBC DSN can be defined for either 32 or 64 bit applications, therefore care must be taken to ensure that all ODBC DSNs for Enterprise Architect's use are defined sharing the same architecture. This is particular important from Enterprise Architect version 16 onwards because it is now available in both 32 and 64 bit versions. An alternative solution (and what Sparx Systems recommend) is to make use of Native connections, since they work for both architectures.
- 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
- 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