The instructions below show you how to import the structure of a database into UModel. You will also learn how to generate a UML diagram that illustrates the database structure. The database used in this tutorial is a sample Microsoft Access database; however, the steps are very similar for other database types supported by UModel.
To import a database into UModel:
1.On the Project menu, click Import SQL Database.
2.If this is the first time you are importing a database into UModel, click New. Otherwise, you can select an existing database connection from the Data Source list.
3.In this example, we are connecting to a local Microsoft Access database. Therefore, select Microsoft Access (ADO) as database kind, and then click Next. Otherwise, follow the wizard steps to connect to your preferred database. Depending on the database kind, you may need to install a database driver before you can connect. For specific examples, see Database Connection Examples.
4.Browse for the following database file: C:\Users\<username>\Documents\Altova\UModel2020\UModelExamples\Tutorial\altova.mdb, and then click Connect.
5.Enter a descriptive name for your data source. The data source name set here will later be available for selection when you want to connect to the same database again.
6.Select the database objects that you would like to import into the model. In this example, all user tables are imported. Also, notice the option Overwrite Model according to Database is selected (which means all elements in the project will be replaced with those imported from the database). For existing projects, change this option to Merge Database into Model.
7.Click Next. Select the diagram generation options as shown below:
After the import, the project contains all the object imported from the database (tables and their structure). Two diagrams are also created, a database diagram that illustrates the database objects, and a package dependency diagram.
A illustrated above, the data source ("tutorial_database" in this example) has become a package in the model. The database itself ("altova") has also become a package that has both the «Database» stereotype and the «namespace» stereotype. To view the properties of a package, click the package and then look at the Properties window, for example:
|Note:||After a database import, UModel creates packages and applies stereotypes depending on the database kind. The model above is illustrative of Access databases.|
All database tables become classes in the model, and get the «Table» stereotype. Notice also that, after the import, the Database profile (DB Profile.ump) has been automatically added to the project.
At this stage, the project is configured for code engineering from database to model. That is, whenever you want to update the UModel project with the latest database changes, run the following command:
•On the Project menu, click either Merge UModel Project from Program Code or Overwrite UModel Project from Program Code.
If you intend to synchronize from the model to the database, see Configuring Roundtrip Engineering for Databases.