DB2 9.5 and the IBM Data Studio - Part 2 - Page 2
November 5, 2007
The basics: editing, deleting, disconnecting, and refreshing connections
You can perform a number of basic operations from a live database connection so I decided to lump them all together in this one section.
The Edit Connection option
You can edit a database connection whether its object is connected or not. When you select Edit Connection, the Edit Connection window opens:
You may want to edit a database connection for several reasons, such as to use a different user account that has different privileges on the data server, or to modify a filter created on the original database connection object. Im not going to detail all the things you can do with this option because they are very similar to those available when adding a new database connection, which were outlined in Part 1 of this series.
Tip: If you frequently work with different user IDs or focus on different schemas, I recommend that, instead of editing the database connection object, you simply create multiple connections to the same database with different credentials or schema filters. For example, in the following figure, you can see that I have multiple database connection objects that are bound to the SAMPLE database. One of the connections has a filter that applies a PAULZ-only schema filter and another object doesnt have any filter at all yet both use the same user account to connect to the data server. A third database connection object uses a different user account (SECADM) to connect to the database:
The Delete option
The Delete option in this context only deletes the database connection object not the database itself. (I can hear the sighs of relief already.) The only other thing Ill mention about this option is that you dont get a confirmation dialog box when you select it (at least in the beta version) so ensure that this is what you want to do.
The Disconnect option
As you might expect, you use this option to disconnect a database connection object from the database for which it was created. Note that the disconnection happens only on the selected database connection object. For example, if you had two database connection objects with live connections to the same database, disconnecting one object will not affect the other, as shown below:
Note: The Disconnect options icon can be a bit misleading because its the same as the disconnected server icon. The purpose of the icon is to represent the final state, but because of its color, it may appear as if its not an available option.
The Refresh option
As you change things in the Database Explorer view, those changes arent always immediately reflected in this view. Several reasons for the delay are possible: you are working in offline mode, the cache hasnt been updated, and so on. If you ever create an object and it doesnt show up, or connect to a database and the status still shows disconnected, select the Refresh option. (If youve ever worked with the Windows Explorer in Microsoft Windows then youre already familiar with this clean-up task; its the same concept here).
Add to Overview Diagram
When you are connected to a database, you can add the database object to an overview diagram. Overview diagrams automatically include all or a selected set of data objects. If you build overview diagrams using the Information Engineering (IE) or Unified Modeling Language (UML) notation, you can discover and draw implicit foreign key relationships between these objects. I find that overview diagrams help me to understand the interaction between data objects.
When you select the Add to Overview Diagram option, IBM Data Studio gives you the option to select a number of schema objects (or a subset of them) to add to the overview diagram using the Overview Diagram Selection window:
Note, however, that the contents of the Overview Diagram Selection window are entirely dependent on any filters applied to the database connection object. For example, in Part 1 of this series, I applied a schema filter to show only the PAULZ schema, which is why that is the only option returned in the previous window.
If you disable this filter by editing the database connection or changing an object-specific filter, then the results of such actions would be taken into consideration when you select the Add to Overview Diagram option, as shown below:
In the previous figure, you can see that I disabled the PAULZ-only schema filter by selecting the Disable filter option. You can change a database-level filter or any database connection information by selecting the Edit Connection option from the pop-up menu for a database object.
The following overview diagram was created in my IDE when I simply selected the PAULZ schema from my filtered database connection object:
This doesnt look very helpful, does it? (Rest assured: it will be.) The IDE doesnt automatically adjust or zoom into this diagram because it has the potential to be huge. To enlarge this diagram simply double-click the title bar () and it will expand to fill the entire IDE. It should now look like this:
In this example, its still not that helpful because there are a lot of relationships in the SAMPLE database. IBM Data Studio provides an Outline view, which you can use to navigate large diagrams:
In the previous figure, you can see the linkage between the Outline view on the right, and the corresponding magnified view in the designer palette. There is more to the Outline view, but Ill cover all of its capabilities in a future article.
You can further customize how the storage diagram looks by using the Properties tab, or by adding meta-data shapes and notes (such as grouping a set of related tables in a polygon or adding a note to an object describing its business use). For example, in the following figure, I used the Properties tab to include column names, types, and so on:
There are lots of features associated with overview diagrams, and Ill cover those in my next article.