CREATE USER MAPPING statement - Examples for the Sybase wrapper

Use the CREATE USER MAPPING statement to map a federated server user ID to a Sybase server user ID and password. This topic provides a complete example with the required parameters, and an example that 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 server user ID to a Sybase server user ID and password:
CREATE USER MAPPING FOR maria SERVER SYBSERVER 
       OPTIONS (REMOTE_AUTHID 'mary', REMOTE_PASSWORD 'day2night');
maria
Specifies the local user ID that you are mapping to a user ID that is defined at the Sybase server.
SERVER SYBSERVER
Specifies the server definition name that you registered in the CREATE SERVER statement for the Sybase server.
REMOTE_AUTHID 'mary'
Specifies the user ID at the Sybase server to which you are mapping maria. The value is case-sensitive, unless you set the FOLD_ID server option to 'U' or 'L' in the CREATE SERVER statement.

Although the remote user ID is specified as an option in the CREATE SERVER statement, it is required for Sybase data sources.

REMOTE_PASSWORD 'day2night'
Specifies the password that is associated with 'mary'. The value is case-sensitive, unless you set the FOLD_PW server option to 'U' or 'L' in the CREATE SERVER statement.

Although the remote password is specified as an option in the CREATE SERVER statement, it is required for Sybase data sources.

Db2 special register USER

You can use the Db2 special register USER to map the authorization ID of the person who is issuing 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 SYBSERVER
       OPTIONS (REMOTE_AUTHID 'mary', REMOTE_PASSWORD 'day2night');