Last year we introduced some helpful terminology about IBM Data Studio. The learning curve can be fairly steep for those who come from a background that does not regularly use the Eclipse framework. We also looked at some of the primary uses for IBM Data Studio including stored procedure development and query tuning. In order to accomplish these tasks it is necessary to understand the basic perspectives that are part of IBM Data Studio and know the tasks that you can accomplish in each.
Review of Terminology
View - When IBM Data Studio is launched the first thing you will see is the workbench. The workbench is made up of one or usually more views where work will be accomplished. Each view may be closed, minimized or resized as needed. The default views and positions will depend on which perspective you are using. Views may also be expanded to consume the entire workbench by double clicking on the tab for the view. Double clicking on the tab again will place it back where it belongs on the workbench. This will become especially important when you are working on something exclusively (such as a query script or stored procedure) and the other views on the screen become “noise.” Whenever you want to return everything to its normal place in your perspective, you can click “Window” then “Reset Perspective.” This will retrieve any “lost” views. When using an editor you can get context sensitive help by pressing CTRL-space.
Perspective - In Eclipse, a perspective is a default collection of views and actions along with the size and position of the views on the screen. When using IBM Data Studio it is often helpful to use the “Data” perspective, but there are other perspectives for Administration, Tuning, Debugging and many more. You can change your perspective using the button on the top right. You can also customize or create your own perspectives. You can add views by clicking Window -> Show View.
In Eclipse you set your perspective in the top right corner of the screen.
The arrow on the left shows the button to push to change perspectives. The last several perspectives used appear to the right of this button. In this case the “Data” perspective button is depressed which indicates this is our current perspective. To see the other options press the button on the left.
Some of these perspectives come with Eclipse and others are added specifically for IBM Data Studio. In this article we will examine a few key perspectives that are commonly used to accomplish DB2 tasks. Keep in mind that you may also create your own perspectives by arranging views on the workbench in a way you like and then clicking Window -> Save Perspective As. Your new perspective will then show in the list of available perspectives. You can also change the default perspective but clicking Windows -> Preferences and navigating to “General” and then “Perspectives." This will show a list of all perspectives and allow you to set one as the default.
Database Administration Perspective
This is the default perspective when you install IBM Data Studio. The focal point of this perspective is the Administration Explorer which will allow the user to make database connections and organizes the server (or node) where they reside. Database Administrators use this perspective to create, view and alter database objects. It is often the wrong perspective to use for common development tasks.
The Data perspective is the one most commonly used for application development tasks. In this perspective the Administration Explorer is replaced by the Data Source Explorer in the bottom left of the workbench. The Data Source Explorer organizes database connections by database (for z/OS this corresponds to a DB2 subsystem; on LUW this is a database). There is a Data Project Explorer in the top left to manage “projects” which will store the work that you do locally. The center of the screen is usually occupied by an editor where you can work with SQL Scripts, stored procedures, XML and more.
Database Development Perspective
The Database Development Perspective is part of the generic Eclipse install and allows the user to navigate database objects. It is commonly used by Java developers to interface with the database that their application is using.
IBM SQL and Routine Development Perspective
This perspective is a modified Data Perspective that omits the “Outline” view from the right side of the workbench. Since outlines are not currently populated for SQL PL code this perspective gives more space on the workbench for the editor and the other views. When developing stored procedures and user defined functions (UDFs) you can use either this perspective or the Data Perspective.
Database Debug Perspective
The Database Debug Perspective is a slightly modified Debug perspective. This debugger was originally part of Eclipse to assist in debugging Java code. Either of these perspectives may be used when debugging DB2 stored procedures. When you invoke the debugger from a different perspective you will be prompted to switch to the Debug perspective.
When you are finished debugging you will need to manually switch back to a more appropriate perspective (usually the Data Perspective) using the method described at the beginning of this article.
Phil Nelson has written a fine article on debugging here.
IBM Query Tuning Perspective
This is the perspective to use when invoking the query tuner. It replaces the Data Project Explorer with a generic Project Explorer that will also show query tuning projects. To invoke the query tuner first switch to this perspective and then right click on your database connection and select “Start Tuning”.
Don’t forget to review the documentation on IBM Data Studio to get the latest information on the product.
July is IBM Data Studio and Data Server month on the IDUG content blog. Look for more articles here throughout the month!