Profiles can be used to control which client applications use features that are associated with a specific Db2 for z/OS application compatibility level. This capability allows client applications that do not need to use new features to continue to connect to a Db2 for z/OS server at an earlier application compatibility level.
About this task
In this example procedure, client application ACCTG_APP501 needs to use Db2 for z/OS capabilities that are available at application compatibility level V12R1M501. All other client applications need to use capabilities that are available at application compatibility level V12R1M500 or lower.
Procedure
- On the client operating system, bind the client driver packages into two collections:
- One collection with the default collection name NULLID, and with the APPLCOMPAT option set to V12R1M500. If you have already bound the client driver packages into collection NULLID with APPLCOMPAT set to V12R1M500, you do not need to bind them again.
- Another collection with a different name, such as NULLID_NF, and with the APPLCOMPAT option set to V12R1M501.
- For the IBM® Data Server Driver for JDBC and SQLJ, follow these steps to bind the driver packages:
- If you have not already done so, invoke the DB2Binder utility with a control statement like this one to create a collection with the default name NULLID, and with application compatibility set to V12R1M500:
java com.ibm.db2.jcc.DB2Binder -url jdbc:db2://sys1.svl.ibm.com:5021/STLEC1 \
-user user -password password \
-bindoptions "APPLCOMPAT V12R1M500" -action REPLACE
- Invoke the DB2Binder utility with a control statement like this one to create a collection named NULLID_NF, with application compatibility set to V12R1M501:
java com.ibm.db2.jcc.DB2Binder -url jdbc:db2://sys1.svl.ibm.com:5021/STLEC1 \
-collection NULLID_NF \
-user user -password password \
-bindoptions "APPLCOMPAT V12R1M501" -action REPLACE
- For the IBM Data Server Driver for ODBC and CLI, follow these steps to bind the driver packages:
- In Db2 for z/OS, create a profile for client application ACCTG_APP501 by inserting rows into tables SYSIBM.DSN_PROFILE_TABLE and SYSIBM.DSN_PROFILE_ATTRIBUTES. The profile directs Db2 to use the driver with packages in collection NULLID_NF when application ACCTG_APP501 runs. Because the driver packages in the NULLID_NF collection are bound with option APPLCOMPAT V12R1M501, ACCTG_APP501 can use capabilities that are available at application compatibility level V12R1M501.
INSERT INTO SYSIBM.DSN_PROFILE_TABLE
(PROFILEID, CLIENT_APPLNAME, PROFILE_ENABLED)
VALUES (1002, 'ACCTG_APP501', 'Y');
INSERT INTO SYSIBM.DSN_PROFILE_ATTRIBUTES
(PROFILEID, KEYWORDS, ATTRIBUTE1)
VALUES (1002, 'SPECIAL_REGISTER', 'SET CURRENT PACKAGE PATH=NULLID_NF');
Important: Although PKGNAME can be used as a filtering category for profile table rows that use the 'SPECIAL_REGISTER' value for KEYWORDS, when client drivers are used, you should not use PKGNAME alone or in combination with COLLID.
- On Db2 for z/OS, issue the -START PROFILE command to load the updated profile tables into memory.
Results
Application ACCTG_APP501 can now successfully connect to Db2 for z/OS and use data server driver packages in collection NULLID_NF. All other applications can connect to Db2 for z/OS and use data server driver packages in collection NULLID.
You can verify the application compatibility level and collection that are being used for your client application by adding code to execute a query like this to your application.
SELECT CURRENT APPLICATION COMPATIBILITY,
GETVARIABLE('SYSIBM.PACKAGE_SCHEMA')
FROM SYSIBM.SYSDUMMY1
For example, you might add code like this to a Java application:
String currApplcompat, appCollection;
Connection con;
Statement stmt;
ResultSet rs;
…
stmt = con.createStatement(); // Create a Statement object
rs = stmt.executeQuery("SELECT CURRENT APPLICATION COMPATIBILITY," +
" GETVARIABLE('SYSIBM.PACKAGE_SCHEMA')" +
" FROM SYSIBM.SYSDUMMY1"); // Get the result table from the query
while (rs.next()) { // Position the cursor
currApplcompat = rs.getString(1); // Retrieve the application compatibility
System.out.println("APPLCOMPAT = " + currApplcompat);
// Print the application compatibility
appCollection = rs.getString(1); // Retrieve the collection name
System.out.println("COLLID = " + appCollection);
// Print the collection name
For application ACCTG_APP501, the query should return a value of V12R1M501 for the current application compatibility, and NULLID_NF for the collection name.