You can create profiles to specify that Db2 sets certain special register values for remote applications that use TCP/IP connections and meet the criteria that are defined in the profile. FL 500 Profiles can also specify SET CURRENT LOCK TIMEOUT statements for local applications.
About this task
You can use profile tables to set the value of certain Db2 special registers. For the list of these special registers, see the description of ATTRIBUTE1.
FL 500 Profiles that specify SET CURRENT LOCK TIMEOUT statements can apply to remote TCP/IP applications only, local applications only, or both. Profiles for other special registers apply only to remote applications. For more information, see the ATTRIBUTE2 column description.
Special register values that are set through the profile table take precedence over values that are set by the application before the first non-SET SQL statement. For example, values set by a profile override values that are set through a client connection or data source properties when the connection is first established. The special register values persist for the lifetime of the connection unless the application explicitly sets the special register. Special register values that are set explicitly by the application take precedence over values that are set by the profile table facility and values that are set by the client connection and data source properties. System directed connections, such as three-part name references, use the values of the special registers of the requesting Db2 site. For example, if a Java™ application establishes a connection to Db2 site 1, the special register values are established with the profile tables from site 1. Later, if the application runs an SQL statement with an implicit three-part name connection to Db2 site 2, then the special register values that are established on site 1 are referenced when the SQL statement runs on site 2.
Special register values that are set through the profile table facility observe the existing rules for inheritance within a routine as defined by INHERIT SPECIAL REGISTERS or DEFAULT SPECIAL REGISTERS routine options. After a user-defined function or a stored procedure completes, Db2 restores all special registers to the values they had before invocation.
As with other special register behavior, commits and rollbacks do not change special register values regardless of how they were established.
Procedure
To modify special register values for the behavior of specific dynamic SQL statements, complete the following steps:
- In the SYSIBM.DSN_PROFILE_TABLE table, insert a row to create the profile and specify its filtering criteria:
- In the PROFILEID column, specify a unique value or accept the generated default value. This value identifies the profile and the relationship between DSN_PROFILE_TABLE and DSN_PROFILE_ATTRIBUTES rows.
- Specify the filtering criteria of the profile.
You can specify values in the columns from one of the following
filtering
categories:
Application type |
Filtering category |
Remote applications: |
- LOCATION only
- PRDID only
- AUTHID, ROLE, or both
- COLLID, PKGNAME, or both
- One of CLIENT_APPLNAME, CLIENT_USERID, or CLIENT_WRKSTNNAME
The filtering values are not case-sensitive, and profiles can match regardless of the case of the input values.
|
FL 500
Local applications: |
- AUTHID, ROLE, or both
- COLLID, PKGNAME, or both
- One of CLIENT_APPLNAME, CLIENT_USERID, or CLIENT_WRKSTNNAME
The filtering values are not case-sensitive, and profiles can match regardless of the case of the input values.
|
Other filtering columns must contain the null value.
Tip: If you create multiple profiles with overlapping filtering criteria,
Db2 applies only one profile from each filtering category, based on a specific order of precedence.
If multiple DSN_PROFILE_TABLE rows specify the same filtering criteria, only the newest is row is accepted when you start the profiles, and the other duplicates are rejected. Also, exact values take precedence over values that use an asterisk (*) wildcard. However, profiles from different filtering categories can all apply. For more information about these rules, see
How Db2 applies multiple matching profiles for threads and connections.
- In the PROFILE_ENABLED column, specify 'Y' so that the profile is enabled when profiles are started.
If the PROFILE_AUTOSTART subsystem parameter setting is YES, the profile starts when you issue a START PROFILE command or when Db2 starts.
- Specify the special register that you want to set by inserting a row into SYSIBM.DSN_PROFILE_ATTRIBUTES with the following column values:
- Specify the PROFILEID value from the DSN_PROFILE_TABLE row that specifies the filtering criteria for this profile.
Tip: Use the same PROFILEID value for any DSN_PROFILE_ATTRIBUTES rows that require the same filtering criteria.
If multiple DSN_PROFILE_TABLE rows contain exactly matching filtering criteria, only the newest duplicate row is accepted when you start the profiles, and the others are rejected and disabled.
- Insert 'SPECIAL_REGISTER' in the KEYWORDS column.
- In the ATTRIBUTEn columns, specify the attributes of the profile:
- ATTRIBUTE1
- For SPECIAL_REGISTER, specifies a SET statement that assigns a value to a special register. The column value consists of a string that contains the SET keyword, the name of the special register, an equal sign, and the value to be assigned.
The SET statement must follow the rules for the SET special register statement. Also, the following rules apply to the ATTRIBUTE1 value for SET statements for all supported special registers:
- An equal sign (=) must be specified between the special register name and the value that is assigned.
- The value that is specified for assignment must be valid for the special register.
- The value must not be an expression, or reference other special registers or variables, unless the statement is SET CURRENT PACKAGE PATH.
- The value that is specified for assignment is passed through this interface as a literal string, unless the statement is SET CURRENT PACKAGE PATH. For example, if a value to be assigned is the same as the name of a special register, Db2 stores the special register name, and not the special register value.
- The maximum length of a SET statement is 1024 bytes.
- The statement must be a Unicode string and encoded with the appropriate CCSID for the application.
The following table lists the SET statements that can be specified in a profile and considerations for specific special registers.
- ATTRIBUTE2
- For SPECIAL_REGISTER, specifies whether the profile applies to threads for remote applications, local applications, or both.
FL 500 The value must be NULL unless the ATTRIBUTE1 value specifies a SET CURRENT LOCK TIMEOUT statement.
- NULL
- The profile applies to remote threads only. The profile is evaluated and SET statements are processed only when the first package is loaded, and when the first SQL statement (other than a SET statement) in the package executes.
- 1
- The row applies to local threads only. Profiles are evaluated and SET statements are processed when each package is loaded.
- 2
- The row applies to local and remote threads. For remote threads, the behavior is the same as if the value is NULL. For local threads, the behavior is the same as if the value is 1.
- ATTRIBUTE3
- NULL
- Load or reload the profile tables into memory by issuing a START PROFILE command. (For best results, do not issue a STOP PROFILE command when you add or modify existing profiles. Use the STOP PROFILE command only if you intend to disable all existing profiles.) For more information, see Starting and stopping profiles.
- Check the status of all newly added profiles in the STATUS columns of the DSN_PROFILE_HISTORY and DSN_PROFILE ATTRIBUTES_HISTORY tables.
Successful completion of the START PROFILE command does not imply that all profiles started successfully. If the STATUS column of either history table contains a value that does not start with 'ACCEPTED', further action is required to enable the profile or the keyword action.
Example
Suppose that you insert the following row in SYSIBM.DSN_PROFILE_ATTRIBUTES:
PROFILEID |
KEYWORDS |
ATTRIBUTE1 |
ATTRIBUTE TIMESTAMP |
17 |
SPECIAL_REGISTER |
SET CURRENT APPLICATION COMPATIBILITY = 'V10R1' |
2013-10-23... |
This row specifies that
Db2
is to set the APPLICATION COMPATIBILITY special register to 'V10R1' when referenced by dynamic SQL
for applications that match the filtering criteria specified in the row with PROFILEID='17'
DSN_PROFILE_TABLE row.