APIs for federated trusted connections
The APIs that you use to request and to reuse a trusted connection depend on the type of application.
To request a federated trusted connection, the application must specify
these APIs.
- CLI/ODBC applications
- Use SQLSetConnectAttr with the attribute SQL_ATTR_USE_TRUSTED_CONTEXT to indicate whether the client is requesting a trusted connection. Then issue an SQLConnect.
- XA CLI/ODBC applications
- In an xa_open string request, set the TCTX attribute to true to request a trusted connection.
- Java™ applications
- Use getDB2TrustedPooledConnection or getDB2TrustedXAConnection to request a trusted connection.
To reuse the connection for another user, with or without requiring authentication,
the application must specify these APIs:
- CLI/ODBC applications
- Use SQLSetConnectAttr to set the SQL_ATTR_TRUSTED_CONTEXT_USERID and SQL_ATTR_TRUSTED_CONTEXT_PASSWORD to specify the user ID and password of the user to whom the connection is being switched.
- XA CLI/ODBC applications
- Use SQLSetConnectAttr to set the SQL_ATTR_TRUSTED_CONTEXT_USERID and SQL_ATTR_TRUSTED_CONTEXT_PASSWORD to specify the user ID and password of the user to whom the connection is being switched.
- Java applications
- Use getDB2Connection and reuseDB2Connection.