Data Studio and DB2 for z/OS Stored · PDF fileibm.com/redbooks Redpaper Front cover Data Studio and DB2 for z/OS Stored Procedures Paolo Bruni Marichu Scanlon Understand IBM Data

  • Upload
    vodang

  • View
    228

  • Download
    1

Embed Size (px)

Citation preview

  • ibm.com/redbooks Redpaper

    Front cover

    Data Studio and DB2 for z/OS Stored Procedures

    Paolo BruniMarichu Scanlon

    Understand IBM Data Studio V2.2.1 packaging

    Use Data Studio with DB2 10 for z/OS stored procedures

    Take advantage of the Unified Debugger

    http://www.redbooks.ibm.com/ http://www.redbooks.ibm.com/

  • International Technical Support Organization

    Data Studio and DB2 for z/OS Stored Procedures

    March 2011

    REDP-4717-00

  • Copyright International Business Machines Corporation 2011. All rights reserved.Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP ScheduleContract with IBM Corp.

    First Edition (March 2011)

    This edition applies to IBM DB2 Version 10.1 for z/OS (program number 5605-DB2), IBM InfoSphere Optim Development Studio Version 2.2.1 (program number 5724-X83), and IBM Data Studio Version 2.2.1, available from: http://www.ibm.com/developerworks/downloads/im/data/index.html

    Note: Before using this information and the product it supports, read the information in Notices on page vii.

    http://www.ibm.com/developerworks/downloads/im/data/index.html

  • Contents

    Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viiTrademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii

    Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ixThe team who wrote this paper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ixNow you can become a published author, too! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xComments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xStay connected to IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .x

    Chapter 1. The IBM Data Studio V2.2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Understanding the Data Studio packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Eclipse Workbench common terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    1.3.1 Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3.2 Resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.3.3 Perspectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.3.4 Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.3.5 Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.3.6 Wizards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.3.7 Task Launcher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    1.4 Installation, configuration, and setup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.4.1 Connectivity and the JDBC driver selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.4.2 Client setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.4.3 DB2 for z/OS setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.4.4 Unicode support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121.4.5 Setup for SQL and Java stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121.4.6 WLM application environments and procedures. . . . . . . . . . . . . . . . . . . . . . . . . . 171.4.7 Data Studio actual costs setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191.4.8 Data Studio and JDBC driver selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201.4.9 Java SDK used by Data Studio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201.4.10 Overview of routine development with Data Studio . . . . . . . . . . . . . . . . . . . . . . 23

    1.5 Navigating through the Data Studio workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261.5.1 Task Launcher view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271.5.2 Data Source Explorer view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281.5.3 Administration Explorer view. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351.5.4 Data Project Explorer view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361.5.5 Output view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391.5.6 Editor view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

    Chapter 2. Developing stored procedures with Data Studio. . . . . . . . . . . . . . . . . . . . . 492.1 Getting started with Data Studio stored procedures development . . . . . . . . . . . . . . . . 50

    2.1.1 Starting Data Studio for the first time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502.1.2 Creating a connection profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512.1.3 Editing the connection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542.1.4 Creating a Data Development Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552.1.5 Creating SQL statements and scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

    2.2 Creating a new stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602.2.1 Creating a new stored procedure using templates . . . . . . . . . . . . . . . . . . . . . . . . 612.2.2 Copying and pasting (or dragging and dropping) from the Data Source Explorer 62

    Copyright IBM Corp. 2011. All rights reserved. iii

  • 2.2.3 Importing the source of a stored procedure from a file . . . . . . . . . . . . . . . . . . . . . 632.3 Modifying the stored procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

    2.3.1 Copying and pasting, and inserting from file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632.3.2 Editing the Java source. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    2.4 Importing a stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 652.4.1 Importing an SQL stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 652.4.2 Importing a Java stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

    2.5 Deploying a stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712.5.1 The Deploy wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712.5.2 Deploy options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722.5.3 Routine options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 742.5.4 Deploying to a different server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 772.5.5 Deploying nested or dependent stored procedures . . . . . . . . . . . . . . . . . . . . . . . 782.5.6 Setting the JDK level for Java stored procedures. . . . . . . . . . . . . . . . . . . . . . . . . 782.5.7 Setting the bind options in native SQL stored procedures . . . . . . . . . . . . . . . . . . 802.5.8 Enabling debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

    2.6 Executing a stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802.6.1 Run Settings dialog. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 812.6.2 Processing information in the Data Output view . . . . . . . . . . . . . . . . . . . . . . . . . . 82

    Chapter 3. Additional development features in the Data Studio products . . . . . . . . . 853.1 Additional features in Data Studio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

    3.1.1 Native SQL procedure new version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 863.1.2 Developing templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873.1.3 CURRENT SQLID and CURRENT SCHEMA usage in Data Studio . . . . . . . . . . 883.1.4 Package owner and build owner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 883.1.5 Export and deploy stored procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 893.1.6 D