DB2 Development Center Advanced Topics for z/OS Software Group Peggy Rader - [email protected] DB2...
Transcript of DB2 Development Center Advanced Topics for z/OS Software Group Peggy Rader - [email protected] DB2...
IBM Software Group
Peggy Rader - [email protected]
DB2 Development Center Advanced Topics for z/OS
IBM Software Group | DB2 Information Management Software
Agenda
Getting StartedEnvironment SettingsJDBC Driver SupportUsing Java SDK 1.3.1 and SDK 1.4.1Multiple versions of SQL and Java SPsMiscellaneous
February 2005 (c) IBM Corporation 1-2
IBM Software Group | DB2 Information Management Software
Getting Started
Development Center (DC)Included in Application Development Client in DB2 UDB for Windows,Linux and Unix V8.1
Fixpak 7 latest available at the time of this presentationKnown as DC 8.1
Included in Application Development Client in DB2 UDB for Windows, Linux and Unix V8.2
Known as DC 8.2DC 8.1 at FP7 is equal to DC 8.2 base level code
Code name "Stinger" pre GA
Most DC functions included inWSAD V5
(no SQL for z/OS debugging support)RAD V6
(no SQL for z/OS debugging support).NET
(SQL only, includes debugging)
IBM Software Group | DB2 Information Management Software
Getting Started ...Development Center Overview Presentation
Getting Started with the DB2 Development Center to Create SQL and Java SPs - 2 Parts
ftp://ftp.software.ibm.com/software/db2storedprocedure/db2zos390/techdocs/getstarteddc.pdf
Part 1 - Platform NeutralDB2 Application Development Tools OverviewDevelopment Center
PrereqsSetup
Development Center OverviewOther Wizard Options
Part 2 - z/OS Specific including Setup StepsDevelopment Center and z/OS Stored Procedures Processing Overview
PrereqsSetup
DB2Build UtilitySQL SP Debugger with DB2 for z/OS V8
IBM Redbook - Chapter 29www.redbooks.ibm.com - search for SG24-7083
Refreshed in November 2004
February 2005 (c) IBM Corporation 3-4
IBM Software Group | DB2 Information Management Software
Environment SettingsDebugger
Set Java Debugger listening port (distributed DB2)Set SQL timeout value (distributed DB2 and z/OS V8 DB2)
EditorSpecify options for editing source code for selected language
OutputSpecify settings for results and refreshing of objects
ProcessSpecify settings for building, running and tracing
User-assistance featuresSpecify settings for field help and diagnostics
Build optionsSpecify settings for z/OS and OS/390 SQL and Java SPs
Select menu option Project->Environment Settings
IBM Software Group | DB2 Information Management Software
JDBC Driver SupportIn the beginning there was a single JDBC driver on OS/390 that was called the
"JDBC/SQLJ Driver for OS/390"
This driver can be used in Java applications and Java stored procedures that process on OS/390 and z/OS only
Supports type 2 connectivity
February 2005 (c) IBM Corporation 5-6
IBM Software Group | DB2 Information Management Software
JDBC Driver Support ....Next came the Universal JDBC driver, sometimes referred to as the JCC driver
Java Common Client
This driver can be used in Java applications and Java stored procedures on
DB2 for OS/390 V7 and DB2 for z/OS V8DB2 for Unix, Windows and Linux V8
Supports bothType 2 connectivityType 4 connectivity
IBM Software Group | DB2 Information Management Software
JDBC Driver Support ....To distinguish the new Universal JDBC driver from the original JDBC driver a renaming was done
JDBC/SQLJ for OS/390 became known as the
"Legacy JDBC driver" sometimes also known as the
"Classic JDBC driver"
February 2005 (c) IBM Corporation 7-8
IBM Software Group | DB2 Information Management Software
JDBC Driver Support ....Java stored procedures
JDBCDynamic*.class files
SQLJStatic SQL*.class files*.ser file (serialized profile)
Presence of a *.ser file created at when SP is "built" and the DB2PROFC or
DB2SQLJCUSTOMIZE routine is run
IBM Software Group | DB2 Information Management Software
Development Center and JDBC Drivers
//JAVAENV ...DB2_HOME
DC Developer
End-User of Java SP
GENERATED SP RUNTIMESERVERCONNECTION
WLM SPAS
//JAVAENV ...JCC_HOME
LegacyJDBC driver
UniversalJDBC driver
DSNTJSPPuses Legacy JDBC Driver
No DSNTJSPP uses Universal JDBC Driver
z/OS V8 only
Java SQLJ
*.ser
*.ser
1 2 3
z/OS Server
Uses JDBC Driver in 3 steps
February 2005 (c) IBM Corporation 9-10
IBM Software Group | DB2 Information Management Software
DC and the JDBC Driver CombinationsLegacy Driver
type 2 connectivity 1
Universal Driver type 2
connectivity 1
Universal Driver type 4
connectivity 2
DC 8.1- Server Connection Y- Java SP Build (uses DSNTJSPP on z/OS)
Y
- Runtime for Java JDBC 3 Y Y- Runtime for Java SQLJ Y
DC 8.2 = DC 8.1(FP7)- Server Connection Y Y Y- Java SP Build (uses DSNTJSPP on z/OS) Y
- Java SP Build (doesn't use DSNTJSPP on z/OS) Y 4
- Runtime for Java JDBC 3 Y Y- Runtime for Java SQLJ Y Y 4
1. Requires DB2 Connect2. Requires DB2 Connect License Only
3. Java JDBC SP significance at Runtime4. Java SQLJ SP w/ Universal Driver only
created on DB2 for z/OS V8
IBM Software Group | DB2 Information Management Software
Windows Workstation z/OS
AfterDSNTJSPP
calledStart DC
- Use Wizards to create new Java or import existing Java
source- Add User
Code
- sqlj- javac
- make .jar
SETUP USS ENVIRONMENT
DSNTJSPP.properties
INSTALL or REPLACE JAR
READ PROPERTIES FILE
db2sqljjdbc.properties
BIND PACKAGE(SQLJ only)
db2profc(SQLJ only)
CallsDSNTJSPP
PerformTasks
Save options and source in DB2
Catalog
-CREATE PROCEDURE
1.
2.
3. 4. 5.
6.
Pres
sBuil
d
DSNTJSPPz/OS C SP
Calls DSNTBIND
z/OS REXX SP for SQLJ SPs
DC 8.2 Build Process Using DSNTJSPP Java SQLJ SP Generated using Legacy JDBC Driver - type 2 connectivity
February 2005 (c) IBM Corporation 11-12
IBM Software Group | DB2 Information Management Software
Start DC- Use Wizards to create new Java or import existing Java
source- Add User Code
- sqlj (sqlj only)- javac
- jar files
Windows Workstation z/OS
1.
3.
4.
Pres
sBu
ild
DC 8.2 Build Process NOT Using DSNTJSPP
JDBC call using Server Connection
JDBC Driver
2.
Java SQLJ SP Generated using Universal JDBC Driver - type 2 connectivityz/OS - V8 only
DB2_INSTALL or DB2_REPLACE JAR
Save options and source in DB2
Catalog
CREATE PROCEDURE
db2sqljcustomize (sqlj only)
z/OS DB2 JDBCdriver command
DB2 suppliedstored procedure
DB2 catalog call
DB2 catalog call
IBM Software Group | DB2 Information Management Software
How does DC decide to use DSNTJSPP or Not during BuildDefault determined
Project->Environment Settings->Build options->JavaWhen Checkbox "checked" build uses DSNTJSPP
WLM proc needs //JAVAENV DD specifying DB2_HOMEIndicates Legacy JDBC driver
When Checkbox "unchecked" build does NOT use DSNTJSPP WLM proc needs //JAVAENV DD specifying JCC_HOME
Indicates Universal JDBC driver
Default overriddenDuring initial SP build from wizard->Options->AdvancedOn previously built SP from Properties->Build panel
February 2005 (c) IBM Corporation 13-14
IBM Software Group | DB2 Information Management Software
Select Default from Project->Environment SettingsBuild options->Java
Uncheck -> Build using DSNTJSPP
WLM proc needs DB2_HOME
in //JAVAENV
WLM proc needs JCC_HOME
in //JAVAENV
IBM Software Group | DB2 Information Management Software
Override Specific SP from PropertiesDuring initial Build or during Rebuild
Select SP->Right Click->Properties->Build->Check Build using DSNTJSPP
Optionally check
Verbose build
February 2005 (c) IBM Corporation 15-16
IBM Software Group | DB2 Information Management Software
Java Software Development Kit (SDK) UsageWhere are they used?
Used during Build timeBy Development Center
Used during RuntimeBy the WLM proc where the Java SP executes
Java Methods used during Build time must be available in Java Runtime Environment (JRE)
Otherwise - Execution error indicating mismatchEG. Using a Java 1.4.1 method from a Java 1.3.1 JRE
IBM Software Group | DB2 Information Management Software
Java SDK 1.3.1 and SDK 1.4.1Determine which is available by looking at HFS
From OMVS command prompt - Set PathSDK 1.3.1 Default directory
export PATH=/usr/lpp/java/IBM/J1.3/bin:$PATHSDK 1.4.1 Default directory
export PATH=/usr/lpp/java/IBM/J1.4/bin:$PATHEnter
java -version or java -fullversion
java version "1.3.1"Java(TM)2 runtime Environment,Standard Edition (build 1.3.1)Classic VM (build 1.3.1,J2RE 1.3.1 IBM OS/390 Persistent Reusable VM build cm131s-20030913 (JIT enabled:jitc))
No Support for SDK 1.4.0
February 2005 (c) IBM Corporation 17-18
IBM Software Group | DB2 Information Management Software
Java Software Development Kit Usage Build Time
Using Legacy JDBC Driver with SYSPROC.DSNTJSPPUses SDK on clientUses DSNTJSPP.properties file SDK on z/OS
JAVA_HOME environment variable specifies SDK1.3.1 or SDK1.4.1SDK methods used must be available in both client and z/OS SDK
Using Universal JDBC Driver (Supported in DC in DB2 V8.2 only)Build uses SDK on workstation only
IBM Software Group | DB2 Information Management Software
Java Software Development Kit Usage ...Build Time
Default SDK included with Development Center..\sqllib\java\jdk
DC 8.1SDK 1.3.1 default
DC 8.2 - (DC 8.1 at FP7 level)SDK 1.4.1 default
Override default SDK takes 2 stepsSpecify JDK Level and Directory locationSelect JDK level from Database Connection
February 2005 (c) IBM Corporation 19-20
IBM Software Group | DB2 Information Management Software
Override SDK Default for Build Process
2. From Project View
Select Database Connection->Properties -> Java Build Settings
Select JDK Release
1. Specify JDK Level/Directory in Project->Environment Settings->Process-> Java Home
SetJDK LevelDirectory
IBM Software Group | DB2 Information Management Software
Java Software Development Kit Usage ...Run Time
WLM Proc //JAVAENV DD statement selects SDK JAVA_HOME environment variable
DB2 for OS/390 V7Supports SDK 1.3.1 in base productSupports SDK 1.4.1
Requires APAR PQ76769
DB2 for z/OS V8Supports SDK 1.3.1 and 1.4.1 in base product
February 2005 (c) IBM Corporation 21-22
IBM Software Group | DB2 Information Management Software
Java Software Development Kit Usage ...Runtime
JAVAENV Statement Examples using Legacy JDBC driver
SDK 1.3.1 ENVAR("DB2_HOME=/usr/lpp/db2/db2710", "JAVA_HOME=/usr/lpp/java/IBM/J1.3", "DB2SQLJPROPERTIES=/u/DB7PU/db2sqljjdbc.properties"), MSGFILE(JSPDEBUG,,,,ENQ)
SDK 1.4.1 XPLINK(ON),ENVAR("DB2_HOME=/usr/lpp/db2/db2810", "JAVA_HOME=/usr/lpp/java/IBM/J1.4", "DB2SQLJPROPERTIES=/u/DB8AU/db2sqljjdbc.properties"), MSGFILE(JSPDEBUG,,,,ENQ)
Supported with DB2 V7 in APAR PQ76769
IBM Software Group | DB2 Information Management Software
Java Software Development Kit Usage ...Runtime
JAVAENV Statement Examples using Universal JDBC driver
SDK 1.3.1 ENVAR("JCC_HOME=/usr/lpp/db2/db2810/jcc", "JAVA_HOME=/usr/lpp/java/IBM/J1.3"), MSGFILE(JSPDEBUG,,,,ENQ)
SDK 1.4.1 XPLINK(ON),ENVAR("JCC_HOME=/usr/lpp/db2/db2810/jcc", "JAVA_HOME=/usr/lpp/java/IBM/J1.4"), MSGFILE(JSPDEBUG,,,,ENQ)
Supported with DB2 V7 in APAR PQ76769Included in base product with DB2 V8
February 2005 (c) IBM Corporation 23-24
IBM Software Group | DB2 Information Management Software
Java Software Development Kit Usage ...DB2 for OS/390 V7 APAR PQ76769 provides support for
DB2 Universal JDBC Driver **SDK 1.4.1
SDK 1.3.1 continues to be supportedRemoval of 200 parameter limit for Java stored procedures or Java UDFs
** SQLJ SPs No DC 8.1 or DC 8.2 support for Universal JDBC Driver
JDBC SPs Can select Universal JDBC Driver at Runtime with //JAVAENV DD statement JCC_HOME envvar
IBM Software Group | DB2 Information Management Software
Multiple Versions of SQL or Java SPs
Support for different resource requirements on one DB2 server
Test, QA, Production all on same DB2 server using same SP nameMultiple SDK support
When do you need multiple versions?
February 2005 (c) IBM Corporation 25-26
IBM Software Group | DB2 Information Management Software
Multiple Versions of SQL SPs -> DSNTPSMPCreate WLM proc for build process
Use model of SDSNSAMP(DSN8WLMP) with updated definitions for//SQLLMOD//SQLDBRM//SQLCSRC//SYSEXEC (optionally if usermods on DSNTPSMP)
Register additional copy of DSNTPSMP in DB2 Catalog
Create copy of SYSPROC version to new Schema versionModify WLM ENVIRONMENT
Create WLM proc for SQL SP execution//STEPLIB DD statement
Includes dataset from //SQLLMOD DD from the build process
IBM Software Group | DB2 Information Management Software
Multiple Versions of SQL SPs -> DSNTPSMP...Different STEPLIB, DBRM and C Source
Optionally, may need different SYSEXECIf changes needed to DSNTPSMP - would need multiple REXX EXECs
SYSIBM.SYROUTINES PROCEDURE SYSPROC.DSNTPSMP...WLM ENVIRONMENT DB8ASQL1
WLM PROC DB8ASQL1 - used for Build Process
//SYSEXEC DD DISP=SHR,DSN=DB7PU.TEST.SDSNCLST **** //SQLDBRM DD DISP=SHR,DSN=DB7PU.TEST.DBRMLIB.DATA//SQLCSRC DD DISP=SHR,DSN=DB7PU.TEST.SRCLIB.DATA//SQLLMOD DD DISP=SHR,DSN=DB7PU.TEST.RUNLIB.LOAD
WLM PROC DB8ASQL5 - used for SQL SP Execution
//STEPLIB DD DISP=SHR,DB7PU.TEST.RUNLIB.LOAD
SYSIBM.SYROUTINES PROCEDURE MYQA.DSNTPSMP...WLM ENVIRONMENT DB8ASQL2
WLM PROC DB8ASQL2 - used for Build Process
//SYSEXEC DD DISP=SHR,DSN=DB7PU.QA.SDSNCLST **** //SQLDBRM DD DISP=SHR,DSN=DB7PU.QA.DBRMLIB.DATA//SQLCSRC DD DISP=SHR,DSN=DB7PU.QA.SRCLIB.DATA//SQLLMOD DD DISP=SHR,DSN=DB7PU.QA.RUNLIB.LOAD
WLM PROC DB8ASQL6 - used for SQL SP Execution
//STEPLIB DD DISP=SHR,DB7PU.QA.RUNLIB.LOAD
TEST
QA
February 2005 (c) IBM Corporation 27-28
IBM Software Group | DB2 Information Management Software
Multiple Versions of Java SPs -> DSNTJSPPUsing Legacy JDBC driver -> DSNTJSPP
Create additional HFS mount point forDSNTJSPP.properties
JAVA_HOME selects SDKdb2sqljjdbc.properties
Selects DBRMLIBRegister additional copy of DSNTJSPP in DB2 Catalog
Update RUNOPTs to point to new HFS mount pointAll versions of DSNTJSPP can run in "Same" WLM Environment
No changes or additional copies of DSNTBIND needed
Create WLM proc for Java SP execution//JAVAENV DD statement environment variable settings
DB2_HOME for Legacy JDBC driverJCC_HOME for Universal JDBC driverJAVA_HOME for SDK
IBM Software Group | DB2 Information Management Software
Multiple versions of Java SPs -> DSNTJSPP ...SDK 1.3.1 Example
SYSIBM.SYSROUTINES PROCEDURE SYSPROC.DSNTJSPP...RUN OPTIONS 'POSIX(ON),ENVAR("HOME=/u/DB8AU/sdk131")'
/u/DB8AU/sdk131/DSNTJSPP.properties
DB2_HOME=/usr/lpp/db2/db2810JAVA_HOME=/usr/lpp/java/IBM/J1.3DB2SQLJPROPERTIES=/u/DB8AU/sdk131/db2sqljjdbc.propertiesDB2SQLJSSID=DB8ADB2SQLJPLANNAME=DSNSQLJLIBPATH=$DB2_HOME/libCLASSPATH=.:$DB2_HOME/classes/db2j2classes.zipPATH=$JAVA_HOME/bin:$DB2_HOME/bin:/STEPLIB=DB8A.SDSNEXIT:DB8A.SDSNLOAD:DB8A.SDSNLOD2
/u/DB8AU/sdk131/db2sqljjdbc.properties
DB2SQLJDBRMLIB=DB8AU.SDK131.DBRMLIB
WLM PROC DB8AJAV6 - used for Java SP Execution//JAVAENV DD statement
ENVAR("DB2_HOME=/usr/lpp/db2/db2810","JAVA_HOME=/usr/lpp/java/IBM/J1.3","DB2SQLJPROPERTIES=/u/DB8AU/sdk131/db2sqljjdbc.properties"),MSGFILE(JSPDEBUG,,,,ENQ)
February 2005 (c) IBM Corporation 29-30
IBM Software Group | DB2 Information Management Software
Multiple versions of Java SPs -> DSNTJSPP...SDK 1.4.1 Example
SYSIBM.SYSROUTINES PROCEDURE SDK141.DSNTJSPP...RUN OPTIONS 'POSIX(ON),ENVAR("HOME=/u/DB8AU/sdk141")'
/u/DB8AU/sdk141/DSNTJSPP.properties
DB2_HOME=/usr/lpp/db2/db2810JAVA_HOME=/usr/lpp/java/IBM/J1.4DB2SQLJPROPERTIES=/u/DB8AU/sdk141/db2sqljjdbc.propertiesDB2SQLJSSID=DB8ADB2SQLJPLANNAME=DSNSQLJLIBPATH=$DB2_HOME/libCLASSPATH=.:$DB2_HOME/classes/db2j2classes.zipPATH=$JAVA_HOME/bin:$DB2_HOME/bin:/STEPLIB=DB8A.SDSNEXIT:DB8A.SDSNLOAD:DB8A.SDSNLOD2
/u/DB8AU/sdk141/db2sqljjdbc.properties
DB2SQLJDBRMLIB=DB8AU.SDK141.DBRMLIB
WLM PROC DB8AJAV7 - used for Java SP Execution//JAVAENV DD statement
XPLINK(ON),ENVAR("DB2_HOME=/usr/lpp/db2/db2810","JAVA_HOME=/usr/lpp/java/IBM/J1.4","DB2SQLJPROPERTIES=/u/DB8AU/sdk141/db2sqljjdbc.properties"),MSGFILE(JSPDEBUG,,,,ENQ)
IBM Software Group | DB2 Information Management Software
Select Different Build Utility
Create New SPSelect different Build utility on the Options->Advanced->z/OS Options->Build Options->Build utilityPopdown list appears
Example shows SQL Build Utility-- Java selection
similar --
February 2005 (c) IBM Corporation 31-32
IBM Software Group | DB2 Information Management Software
Select Different Build Utility...Update Existing SP
From Project View, select SP-->Right click->Properties->Options->Advanced->Build Options->Build utility
If previously created successfully, drop will fail as proc will have different datasets
Popdown selection
list
IBM Software Group | DB2 Information Management Software
Miscellaneous TopicsUsing code fragmentsMultiple SQL statements with a single result setMultiple SQL statements with multiple result setsUse DC to Copy/Paste SPs between serversDeploying SQL or Java stored procedures without recompiling
February 2005 (c) IBM Corporation 33-34
IBM Software Group | DB2 Information Management Software
Using Code Fragments - SQL Stored ProceduresHeader fragment
Enter code that the wizard will insert in the stored procedure header
Variable declaration fragment
Enter code that the wizard will insert in the stored procedure variable declaration section
Exception handlers fragment
Enter code that the wizard will insert in the stored procedure exceptions handlers section
Pre-return fragmentEnter code that the wizard will insert in the stored procedure pre-return section
IBM Software Group | DB2 Information Management Software
Using Code Fragments - Java Stored ProceduresHeader fragment
Enter code that the wizard will insert in the stored procedure header
Imports fragmentEnter code that the wizard will insert in the stored procedure import section
Data fragmentEnter code that the wizard will insert in the stored procedure data section
Method fragmentEnter code that the wizard will insert in the stored procedure method section
February 2005 (c) IBM Corporation 35-36
IBM Software Group | DB2 Information Management Software
Multiple SQL Statements with a Single Result SetUsing the new wizard when creating SQL or Java stored procedures
From the Definition panel, click the "..." to the right of the Statement setting
# of Result sets
IBM Software Group | DB2 Information Management Software
Multiple SQL Statements with a Single Result Set
On the SQL Statement panel, select
Generate Multiple SQL statements
Click the Add buttonGenerates another SQL statement window
Click OK to generate CASE statement code
February 2005 (c) IBM Corporation 37-38
IBM Software Group | DB2 Information Management Software
Multiple SQL Statements with a Single Result Set ...
...public static void jAVATEST2 (int whichQuery,ResultSet []rs1 )throws
SQLException,Exception......switch (whichQuery){
case 0:sql ="SELECT SCHEMA,NAME FROM SYSIBM.SYSROUTINES";stmt =con.prepareStatement(sql );break;
case 1:sql ="SELECT SCHEMA,NAME FROM SYSIBM.SYSROUTINES";stmt =con.prepareStatement(sql );break;
default:sql ="SELECT SCHEMA,NAME FROM SYSIBM.SYSROUTINES";stmt =con.prepareStatement(sql );
}
Sample code generated for Java
IBM Software Group | DB2 Information Management Software
Multiple SQL statements with Multiple Result SetsRepeat steps for multiple SQL statement shown previouslyFrom the Definition panel, select
Result set Value
Select Multiple
For each SQL Statement, generated code creates
one result setone cursor
February 2005 (c) IBM Corporation 39-40
IBM Software Group | DB2 Information Management Software
Multiple SQL Statements with Multiple Result Sets ...
CREATE PROCEDURE DEVL7083.SQLTEST2 (IN whichQuery INTEGER )RESULT SETS 2LANGUAGE SQLCOLLID DEVL7083WLM ENVIRONMENT DB8ADS1RUN OPTIONS 'NOTEST(NONE,*,*,*)'--------------------------------------------------------------------------SQL Stored Procedure------------------------------------------------------------------------P1:BEGIN
--Declare cursorsDECLARE cursor1 CURSOR WITH RETURN FOR
SELECT SCHEMA,NAME,WLM_ENVIRONMENT FROM SYSIBM.SYSROUTINES;DECLARE cursor2 CURSOR WITH RETURN FOR
SELECT SCHEMA,NAME FROM SYSIBM.SYSROUTINES;--Cursor left open for client applicationOPEN cursor1;--Cursor left open for client applicationOPEN cursor2;
END P1
Sample code generated for SQL
IBM Software Group | DB2 Information Management Software
Use DC to Copy/Paste SPs Between ServersSupports different platforms
z/OS to z/OS, Windows, Linux, Unix or i5/OSWindows to Windows, Linux, Unix, z/OS or i5/OSUnix to Unix, z/OS, Linux, Windows or i5/OSLinux to Linux, Unix, z/OS, Windows or i5/OSi5/OS to i5/OS, z/OS, Windows, Linux or Unix
Requires same DDL supported on source and target serverOpen Project
Add DB Connection for Source and Target ServerSelect SP folder in Source Server
Successfully create SPSelect SP->Right Click->Copy
Select SP folder on Target ServerRight Click->PasteModify SP as needed
Windows SP to z/OS requires WLM Environment addedBuild SP
February 2005 (c) IBM Corporation 41-42
IBM Software Group | DB2 Information Management Software
Use DC to Copy/Paste SPs Between Servers ...
Select DB8A z/OS V8 server
Create DEVL7083.JAVATEST SPCopy from z/OS V8 Server
IBM Software Group | DB2 Information Management Software
Use DC to Copy/Paste SPs Between Servers ...
Select DB2G OS/390 DB2 V7 server
Paste DEVL7083. JAVATESTUpdate WLM Environment to DB2GDEJ1 via SP propertiesBuild SP
February 2005 (c) IBM Corporation 43-44
IBM Software Group | DB2 Information Management Software
Deploying SQL Stored Procedures Without RecompilingCurrently, no direct support in DC or other IBM productSteps
Registering the stored procedureBefore registering the DDL, you may need to update the COLLID, WLM AE name, and the SCHEMACopy the DBRMs from the source server and bind the DBRMs in the target serverCopy the compiled SQL module into the production data setGrant execute authorization on the stored procedure
See SG24-7083 Appendix C.1.11 Sample REXX execs for configuration management
IBM Software Group | DB2 Information Management Software
Deploying SQL Stored Procedures Without Recompiling...Promotion of external stored procedures - Compile only once
February 2005 (c) IBM Corporation 45-46
IBM Software Group | DB2 Information Management Software
Deploying Java Stored Procedures Without RecompilingCurrently, no direct support in DC or other IBM productDC installs the compiled Java class bytes and *.ser file (SQLJ only) in the DB2 catalog as a BLOB
SYSIBM.SYSJARCONTENTS
See SG24-7083 Deploying SQL or Java stored procedures without recompiling *
Java stored procedures
* Sample code for steps on next 3 slides found in Redbook, Chapter 29.5.5
IBM Software Group | DB2 Information Management Software
Deploying Java Stored Procedures Without Recompiling ...Extract Java SP from source DB2 server catalogFTP Java SP as JAR or *.CLASS (and *.ser files for SQLJ) from source to target DB2 serverFTP DBRMs (SQLJ only) from source to target DB2 server
Using Legacy JDBC Driver
Bind DBRMs in target DB2 server
February 2005 (c) IBM Corporation 47-48
IBM Software Group | DB2 Information Management Software
Deploying Java Stored Procedures Without Recompiling ...Register procedure in target DB2 server
Modify DDL as necessary (COLLID, WLM ENVIRONMENT)
On target DB2 serverIf SP executed from DB2 catalog
Call SQLJ.INSTALL.JARIf SP executed from JVM Classpath
Update Java SP execution WLM proc //JAVAENV DD statement classpath with JAR
Grant EXECUTE authorization
IBM Software Group | DB2 Information Management Software
Deploying Java Stored Procedures Without Recompiling ...Compile once -
External proceduresDevelopment Production
Extract SPDB2
CatalogModified
DDLDefine stored
procedure
Copy JAR or CLASS
and SER
Call SQLJ.INSTALL_JAR
Bind DBRMsDB2
DBRM lib
HFSHFS
DBRMs Copy
Update WLMproc
DB2 Catalog
//JAVAENV ..CLASSPATH
Runfrom DB2 Catalog
Yes
No
February 2005 (c) IBM Corporation 49-50
IBM Software Group | DB2 Information Management Software
DC 8.2 - FP7Topics
IBM Software Group | DB2 Information Management Software
New DC 8.2 SupportGenerate SP for
Universal JDBC driver on DB2 for z/OS V8Maximum size of JDBC and SQLJ stored procedures increased from 32 KB to 10 MB when using the Universal JDBC driver
applies to both Java source and JAR
New Environment SettingsProvides default build for Java SPs
Select Legacy JDBC driver or Universal JDBC driverSupports COLLID value
Server Connection support for Build processLegacy JDBC Driver type 2 connectivityUniversal JDBC Driver type 2 connectivityUniversal JDBC Driver type 4 connectivity
New
New
February 2005 (c) IBM Corporation 51-52
IBM Software Group | DB2 Information Management Software
DC 8.2 used for Changing JDBC DriversApplies to z/OS DB2 V8 onlyCan use DC to migrate SP from Legacy JDBC driver to Universal Driver
Select existing SP into DC Project that uses Legacy JDBC driverModify SP Properties
Select Build Options"Uncheck" use DSNTJSPPUpdate WLM proc to point to proc with //JAVAENV support for Universal JDBC driver
e.g. JCC_HOME must point to driver, default ->/usr/lpp/db2/db2810/jccRebuild
IBM Software Group | DB2 Information Management Software
DC 8.2 Security Enhancements for Secondary Auth IDs
Database Connection Options
SQL Schema or SQL ID
If it exists, used for SET CURRENT SQLID
Package ownerBuild owner
February 2005 (c) IBM Corporation 53-54
IBM Software Group | DB2 Information Management Software
DC 8.2 Security Enhancements for Secondary Auth IDs ...Package owner
Used for package creating and package bindingThe package owner must hold all the privileges required to create and bind the package for the stored procedure, including
BINDADDCREATE ON COLLECTIONAll privileges necessary for executing the SQL statements within the stored procedure package
If no secondary authorization ID is specified here, the Logon Userid is used
IBM Software Group | DB2 Information Management Software
DC 8.2 Security Enhancements for Secondary Auth IDsBuild owner
Applies to the procedure registration in the DB2 catalogMust hold the CREATEIN ON SCHEMA privilegeIf no authorization name is specified for ‘Build owner’, the SQL ID becomes the default ‘Build owner’If no secondary authorization ID is specified here, the Logon Userid is used
February 2005 (c) IBM Corporation 55-56
IBM Software Group | DB2 Information Management Software
DC 8.1 or DC 8.2 and Secondary Auth IDs
Explicitly update Bind Options during initial Build
Options panel->Advanced button->z/OS Options->Build Options->expand Bind optionsAdd OWNER(DBA3)
PACKAGE(DSNJDBC) ACT(REP) OWNER(DBA3)
IBM Software Group | DB2 Information Management Software
DC SQL Debugger on z/OS DB2 V8
Running SQL Debugger on multi-IP address clientLike a home network
SQL Debugger daemon selects defaultIP Address
First in the list as presented in an IPCONFIG command promptPort
4553
To override default requires FP8IP address to use is the address to the MVS host that your DB2 V8 resides onIf processing behind a firewall
PORT address must be opened for input/output on the server
FP8 required
February 2005 (c) IBM Corporation 57-58
IBM Software Group | DB2 Information Management Software
New Redbook on DB2 for z/OS Stored Procedures
SG24-7083www.redbooks.ibm.com
Includes additional
material - See Appendix C
Refreshed November
2004
IBM Software Group | DB2 Information Management Software
Additional InformationIBM Websites
DB2 Development Centerhttp://www-106.ibm.com/developerworks/db2/zones/db2dc/index.html
Data Management Developer Domainhttp://www7b.software.ibm.com/dmdd/
DB2 for z/OS Stored Procedure Infohttp://www.ibm.com/software/data/db2/os390/spb/
RedbooksSG24-5485: Developing Cross-Platform DB2 Stored proceduresSG24-5945: Java Stored Procedures Learning by ExampleSG24-7083: DB2 for z/OS Stored Procedures: Through the CALL and Beyond
White PapersJDBC drivers supported by the DB2 Stored Procedure Builder and DB2 Development Center for OS/390 and z/OS
http://www-106.ibm.com/developerworks/db2/library/techarticle/dm-0408rader/index.htmlJava SDKs for DB2 Development Center on OS/390 and z/OS
http://www-106.ibm.com/developerworks/db2/library/techarticle/dm-0409rader/Getting Started - DB2 Dev Ctr to Create SQL and Java SPs - 2 Parts
ftp://ftp.software.ibm.com/software/db2storedprocedure/db2zos390/techdocs/getstarteddc.pdf
NEW
February 2005 (c) IBM Corporation 59-60