To find the appropriate database user credentials for CICS transactions or batch jobs, the IBM DB2 XA switch module uses trusted connections, calling the CLI function SQLSetConnectAttr () with the parameter SQL_ATTR_TRUSTED_CONTEXT_USERID. For this call to work properly, you must also create a TRUSTED CONTEXT. This enables the xa_open user ID to impersonate the appropriate database user ID.
The following is provided as a simple example. Your security and database environment might dictate a different implementation. Please review the IBM documentation on trusted connections and other related topics before implementing your solution.
db2 catalog tcpip node tcpnode remote OOH-CHRISLE-701 server 50000
db2 catalog db sample as tcpsamp at node tcpnode
CREATE TRUSTED CONTEXT ctx1 BASED UPON CONNECTION USING SYSTEM AUTHID XAOPENUSER ATTRIBUTES (ADDRESS 'OOH-CHRISLE-701' ) ENABLE ALTER TRUSTED CONTEXT ctx1 ADD USE FOR FRITZ WITHOUT AUTHENTICATION