Create a Database Connection
To synchronize and test your database model through the Database Builder, you make enquiries against a live database. To make connecting to a database easier, you can store the connection details of the database as a Database Connection object, stored in the Connections Package in the Database Builder and under the model root in the Project Browser. Each database model can have several Database Connection objects that each define a connection to a different database or different versions of a database (such as development and production versions); however, only one connection can be active at a time.
It is possible to flag a database connection as the default for the model, so that whenever the model is selected the flagged database connection will be automatically made active.
A Database Connection element is represented in the UML Data Modeling Profile as an Artifact element with the stereotype <<database connection>>.
Create a Database Connection element
You can create a Database Connection element in several ways, such as:
|·||In the Package Browser, right-click on the root node and select Add Element, then select the element type as Database Connection with the Toolset set to DatabaseEngineering::DataModeling, or|
|·||In the Database Builder, right-click on the Connections Package and select Add new DB Connection, then give the element a name, or|
|·||On a 'databasetype' diagram, select the Data Modeling page of the Diagram Toolbox and drag the icon onto the diagram to generate the element:|
In each case, double-click on the new element and specify the type of DBMS the connection is going to use, selecting from:
For the first two options, a prompt displays for the filename of the database, while for the third a prompt displays for you to select an ODBC DSN (select from the Machine Data Source tab). Depending on the DBMS, you might be prompted for other details such as server, connection user ID and password.
Once you have created the Database Connection, you can double-click on the element and maintain the properties, including the additional, optional parameter Other Schemas (only relevant for DBMSs that support multiple schemas). In this field you can type a comma-separated list of schema names, to limit the objects that are shown on the Import (reverse engineering) screen. This is particular useful when modeling Oracle because of the large number of system objects.
Set connection to active
When you create a connection, it is not active. You can activate it in one of two ways:
|·||Set it as the currently-active connection for the immediate work session, or|
|·||Set it as the default automatic connection, so that whenever you select the database model in the Database Builder, that connection is automatically established|
In either case, expand the Connections Package in the Database Builder, right-click on the required connector object and select as appropriate:
|·||Set as active DB Connection or|
|·||Set as default DB Connection|
If a connection is no longer required, you can delete it as for any other element from the Database Builder, the Project Browser or a diagram. Right-click on the element and select the corresponding Delete <element name> option.
|·||The DBMS type of a Database Connection object cannot be changed once the initial selection has been saved|