< Previous | Next >

Deploying the stored procedure for production by using a deployment group

In this exercise, you use a wizard to create a deployment group and then deploy the stored procedure for production from the deployment group.
A deployment group manages the associations between a set of artifacts and the server profiles that are used to deploy them. You can deploy the following types of artifacts from a deployment group:
  • Routines
  • SQL statements
  • PL/SQL packages
  • pureQuery DB2 static bind artifacts

A server profile contains settings that are associated with the corresponding database connection. These settings are used when you deploy or bind database artifacts, such as stored procedures or SQL statements, to the database server. When you create a connection to a database, the workbench uses database defaults and applicable global preferences to automatically generate a server profile for the connection. In the Server Profile Manager view, generated server profiles are indicated with "(generated)" appended to the name.

One of the benefits of deployment groups is that you can manage the deployment of multiple artifacts to multiple databases with one action. This action is more efficient than deploying each artifact individually to each database.

Note: In this tutorial, you use the GSDB database as both the development database and the production database. In a previous exercise, you deployed the stored procedure to the GSDB "development" database for debugging and running. In this exercise, to gain familiarity, you deploy the stored procedure to the "production" database by using a deployment group.
The following table describes the differences between deploying for development and deploying for production.
Table 1. Comparison of deployment actions
Deploying a routine for development Deploying routines for production
You deploy from the Data Project Explorer view. You deploy from the Deployment Group Manager view.
You can deploy only a single routine to a single database at a time. You can deploy multiple routines to multiple databases with one action.
After deployment, the icon next to the routine in the Data Project Explorer view has a wrench on it to indicate that the routine is deployed for development After deployment, the icon next to the routines in the Data Project Explorer view is unchanged.
If you enable debugging, you can start debugging a deployed routine either from the Data Project Explorer view or from the Data Source Explorer view. If you enable debugging, you can start debugging a deployed routine only from the Data Source Explorer view.
You can run a deployed routine either from the Data Project Explorer view or from the Data Source Explorer view. You can run a deployed routine only from the Data Source Explorer view.

To deploy the stored procedure by using a deployment group:

  1. Review the server profile for the GSDB4tutorial connection.
    1. In the Server Profile Manager view, expand the GSDB4tutorial folder, and then double-click GSDB4tutorial Profile (generated). The server profile settings open in the server profile editor.
    2. Click each tab to review the settings. In particular, note the following settings:
      • On the Database Settings page, GOSALESDW is the current schema.
      • On the Routine Settings page, the Enable debugging when applicable check box is selected. When you deploy stored procedures by using a deployment group that the server profile is associated with, during deployment the stored procedures are enabled for debugging.
      You can use the editor to update the server profile settings.
  2. Create the deployment group.
    1. In the Deployment Manager view, click New Deployment Group ( New Deployment Group toolbar button in Deployment Manager view. ) on the toolbar. The New Deployment Group wizard opens.
    2. On the Name page of the wizard, type DG4GSDB for the deployment group name, and then click Next.
    3. Associate the server profile with the deployment group. On the Server Profile Selection page, select GSDB4tutorial Profile (generated), and then click the right arrow button to move the server profile to the Selected box.
    4. Click Next.
    5. Associate the stored procedure with the deployment group. On the Artifact Selection page, select SPDevelopment: SPEMPLOYEE, and then click the right arrow button to move the stored procedure to the Selected box.
    6. Click Finish. The DG4GSDB deployment group is displayed in the Deployment Manager view and the deployment group definition opens in the editor.
      The DG4GSDB deployment group definition displayed in the deployment group editor

      You can use the editor to add artifacts and server profiles to or remove artifacts and server profiles from the deployment group. You also can rearrange the order in which artifacts in the deployment group are deployed and bound. This is helpful in situations where artifact dependencies exist; for example, if you need to create a table before you can create an index on that table.

      If you are deploying multiple artifacts from a deployment group, you can select the error-handling option to use if errors occur during deployment.

  3. Close the deployment group editor.
  4. Deploy the SPEmployee stored procedure. In the Deployment Manager view, right-click the DG4GSDB deployment group, and then click Deploy.

The deployment results are displayed in the SQL Results view. A snapshot of the deployment information is shown in the Deployment Results folder under the deployment group in the Deployment Manager view.

The Deployment Manager view showing deployment results information, artifacts, and server profiles for the DG4GSDB deployment group.

Because the Enable debugging when applicable option was selected in the GSDB4tutorial Profile server profile, the stored procedure is automatically enabled for debugging from the Data Source Explorer.

< Previous | Next >

Feedback