Install and Set Up JDBC for DB2

12-1
The DB2 JDBC environment is installed separately from the
NetMaster
product installation and setup steps. JDBC support for DB2 is supplied as an optional component of DB2 UDB. This component may already be installed on your system:
Component Name: 'DB2 ODBC/JDBC/SQLJ'
Component: 5740XYR02
Versions: 710, 810, and 910
To perform the installation steps, see the IBM publication,
Application Programming Guide and Reference for Java
for your version of DB2 UDB.
  • Not all of the implementation information in the
    Application Programming Guide and Reference for Java
    is relevant to, or required by ReportCenter. Follow the steps in this section and use them as a guide to the IBM documentation.
  • Ignore all references to WebSphere, CICS DB2 applications, and VisualAge for Java because ReportCenter does not use these products. ReportCenter does not use SQLJ, but support for it is provided by the same component that provides JDBC support.
.
To successfully implement JDBC for DB2, you must install the JDBC software and then perform all of the other required configuration steps. Installing the JDBC software alone is not sufficient.
How to Implement DB2 JDBC
To implement DB2 JDBC for ReportCenter, you must do the following:
  • Install the JDBC and SQLJ libraries
  • Note environment variable values
  • (optional) Customize parameters in the SQLJ/JDBC run-time properties file
  • Set up RRS security definitions for DB2
  • Perform other steps, as required, by the Legacy or Universal JDBC driver.
    Implementation procedures differ between the Legacy JDBC Driver and the Universal JDBC Driver. With the Universal Driver, different steps may be required to support Type 2 Connectivity, and Type 4 Connectivity to remote subsystems. Follow the correct IBM documentation for your version of DB2 and choice of driver carefully.
Install the JDBC and SQLJ Libraries
For information about loading the JDBC and SQLJ libraries, see IBM's
Application Programming Guide and Reference for Java
.
This step performs the SMP/E installation of the DB2 JDBC/SQLJ component. This component comprises HFS and SMP/E target libraries. Use your ReportCenter implementation worksheet to record the names of the target library HFS path names and data sets. You need them in later steps.
If the DB2 JDBC/SQLJ component is installed, you do not need to install it again; however, you should carefully review the following steps to ensure that your existing DB2 JDBC environment will work with ReportCenter.
Use your ReportCenter implementation worksheet to record the
full path of the following file:
  • For Legacy JDBC Driver users,
    db2j2classes.zip
  • For Universal JDBC Driver users,
    db2jcc.jar
You must enter this path when you enable ReportCenter on your ReportCenter control region for the first time.
It is not necessary to set the program control extended attribute for ReportCenter.
Note Environment Variable Values
Environment variables are used to communicate site-specific information about your system setup, such as search paths and file names, to processes that run in the UNIX System Services environment, such as the ReportCenter Java Task.
Ask your DBA and systems programmer for the values to use for the JDBC environment variables required by ReportCenter.
Most ReportCenter Java Task operational problems are due to the omitted, incomplete, or inexact setting of USS environmental variables. Care taken with this step can avoid many problems later.
For information about the USS environmental variables that must be set for DB2 JDBC access, see IBM's
Application Programming Guide and Reference for
Java.
The JDBC drivers require the following environment variables to be set correctly. Obtain these values from your systems programmer or DBA and note them in your ReportCenter implementation worksheet because you need them when you customize your ReportCenter control region.
CLASSPATH
Specifies where to find Java classes. Must include the full path name of the JDBC classes file, for example:
  • Legacy Driver
/usr/lpp/db2/db2810/classes/db2j2classes.zip /usr/lpp/db2910_jdbc/classes/db2jcc.jar: \ /usr/lpp/db2910_jdbc/classes/db2jcc_javax.jar: \ /usr/lpp/db2910_jdbc/classes/sqlj.zip: \ /usr/lpp/db2910_jdbc/classes/db2jcc_license_cisuz.jar
  • Universal Driver
PATH
Specifies where to find commands. Must include the Java command directory, for example:
/usr/lpp/java/J1.4/bin
LIBPATH
Specifies where to find DLLs. Must include JDBC DLL directory, for example:
/usr/lpp/db2/db2810/lib
LD_LIBRARY_PATH
Specifies where to find files required by the dynamic linker and loader. Must include JDBC DLL directory, which also contains linker and loader files, for example:
/usr/lpp/db2/db2810/lib
DB2SQLJPROPERTIES
Specifies where to find the JDBC run-time properties. Must be set to full path name of JDBC run-time properties file, for example:
/usr/lpp/db2/db2810/classes/db2sqljjdbc.properties
or
/usr/lpp/db2/db2910/classes/DB2JccConfiguration.properties
The name of the properties file may need to follow a pattern. For more information, see your IBM documentation.
STEPLIB
Specifies where to find DB2 load modules. Must be a concatenation of the DB2 SDSNEXIT, SDSNLOAD, and SDSNLOD2 load library data set names.
After you customize your ReportCenter control region, it generates a .bat file that invokes the ReportCenter Java Task. This file sets the values of these variables for the Java Task.
Customize Parameters in the SQLJ/JDBC Run-time Properties File
The universal driver properties file is a flat text file that is defined to a ReportCenter Java Task using its DB2SQLJPROPERTIES variable in Adaptor.bat. The properties defined in the file affect any use of the universal driver by ReportCenter. This properties file is not required, but is recommended by IBM because it can be used to override DB2 default values.
For information about customizing parameters in the SQLJ/JDBC run-time properties, see IBM's
Application Programming Guide and Reference for Java
, which describes the parameters that can be set in this file.
ReportCenter requires the following parameters:
DB2SQLJSSID=?
db2-subsystem-name
DB2SQLJMULTICONTEXT=YES DB2SQLATTACHTYPE=RRSAF DB2SQLJDBRMLIB=?
dbrm-data-set
Review the remaining parameters, as applicable to your environment.
For the Legacy JDBC driver, the default path name for the SQLJ/JDBC run-time properties file looks similar to the following:
/usr/lpp/db2/db2810/classes/db2sqljjdbc.properties
If you use a new path name for your customized run-time properties file, you must specify that file name in the ReportCenter Customizer parameter group. The Customizer uses it to set the DB2SQLJPROPERTIES environment variable.
For the Universal JDBC Driver, a properties file is optional.
DB2SQLJSSID Parameter
If you use the Universal JDBC driver and do not specify a properties file, be aware of where the default processing sets the SSID property from. SSID specifies the DB2 subsystem identifier (not location name) that the Universal JDBC driver uses.
In some cases, if this is not explicitly specified, the driver may use the subsystem identifier specified in the DSNDECP load module. For this reason, if you use Type 4 Connectivity to access a remote DB2 on another LPAR, you need a properties file that specifies the DB2SQLJSSID name on the other LPAR.
Unspecified, defaulted and incorrect SSID values are the cause of many implementation problems with ReportCenter and the Universal JDBC Driver. For more information, see the IBM Universal JDBC Driver documentation.
DB2SQLJDBRMLIB Parameter
The library name that you enter here is obtained from your Database Administrator. When the SQLJ/JDBC profile is customized in the following step, it writes four Database Request Modules (DBRMs) to the file you specify here.
These DBRMs are then bound by the DBA using a DB2 batch job supplied by IBM. The plan name DSNJDBC is created by this batch job. This plan must be given EXECUTE access to PUBLIC by the DBA.
This library is required only if you are generating a LEGACY driver. For the UNIVERSAL driver, it is not necessary to bind your JDBC packages into a plan.
DB2SQLATTACHTYPE Parameter
ReportCenter uses only an ATTACHTYPE of RRSAF. Alternate attach mechanisms, such as the Call Attach Facility (CAF) or CLI do not support the multithreading requirements of ReportCenter.
The Resource Recovery Manager Services and the z/OS System Logger must be configured to enable the JDBC driver to use the underlying Resource Recovery Services Attachment Facility (RRSAF).
For more information about configuring the Resource Recovery Manager Services Attachment Facility, see the
Application Programming and SQL Guide
for your version of DB2 for z/OS.
ReportCenter does not require customization of the cursor properties file.
Set Up RRS Security Definitions
Check your operational procedures to ensure that the started task Resource Recovery Services (RRS) is always active, in addition to your DB2 subsystem.
ReportCenter works with DB2 subsystems in local or sysplex mode. DB2 JDBC support requires RRS with at least a monoplex defined, that is, a sysplex configuration of monoplex or multisystem. An RRS configuration of xcflocal does not support JDBC for DB2.
Your Security Administrator must define the resources and permissions required for your DB2 subsystem to use RRS, if these have not been defined already.
Perform Other Driver-Specific Steps
Perform other tasks as directed by the specific IBM documentation about implementing the Legacy or Universal JDBC drivers.
These may include tasks such as generating JDBC profile files, binding DBRMs, and so on.
For the same tasks, different OMVS utilities may be invoked by the Legacy (Db2JDBCgen) and Universal (DB2Binder) drivers.
If you are implementing the Universal Driver, different steps may be required for Type 2 Connectivity and Type 4 Connectivity. Follow the ones appropriate to what your database administrator has chosen.
Grant Access to DB2 JDBC
After you successfully complete the steps above, your Database Administrator must grant access to DB2 JDBC functions, by issuing the following command:
GRANT EXECUTE ON PLAN DSNJDBC TO PUBLIC;