CREATE USER MAPPING statement - Examples for the JDBC wrapper
This example shows you how to use the Db2® special register USER with the CREATE USER MAPPING statement.
The following example shows how to map a federated authorization ID to a JDBC data source user ID
and password:
CREATE USER MAPPING FOR DB2INST1
SERVER jdbc_server1
OPTIONS (
REMOTE_AUTHID 'art',
REMOTE_PASSWORD 'red4blue');
- Parameters
-
- DB2INST1
- You can use any valid local Db2 user ID such as a database instance owner or other users to map the authorization ID for the federated database that is specified in the REMOTE_AUTHID user option.
- SERVER jdbc_server1
- Specifies the server definition name that you defined in the CREATE SERVER statement for the JDBC data source.
- REMOTE_AUTHID 'art'
- Specifies the remote user ID to which you map arturo. The value is case-sensitive, unless you set the FOLD_ID server parameter to 'U' or 'L' in the CREATE SERVER statement.
- REMOTE_PASSWORD 'red4blue'
- Specifies the remote password that is associated with 'art'. The value is case-sensitive, unless you set the FOLD_PW server option to 'U' or 'L' in the CREATE SERVER statement.
Db2 special register USER
You can use the Db2 special register USER to map the authorization ID of the person who issues the CREATE USER MAPPING statement to the data source authorization ID that is specified in the REMOTE_AUTHID user option.
The following
example shows a CREATE USER MAPPING statement that includes the special
register USER:
CREATE USER MAPPING FOR USER
SERVER jdbc_server1
OPTIONS (
REMOTE_AUTHID 'art',
REMOTE_PASSWORD 'red4blue');