CREATE USER MAPPING statement - Examples for the Teradata wrapper

Use the CREATE USER MAPPING statement to map a federated server authorization ID to a remote Teradata user ID and password. This topic includes 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 local authorization ID to a remote Teradata user ID and password:
CREATE USER MAPPING FOR MICHAEL SERVER tera_server
       OPTIONS (REMOTE_AUTHID 'mike', REMOTE_PASSWORD 'passxyz123');
MICHAEL
Specifies the local authorization ID that you are mapping to the remote user ID and password, which are defined at the Teradata server.
SERVER tera_server
Specifies the server definition name that you registered in the CREATE SERVER statement for the Teradata server.
REMOTE_AUTHID 'mike'
Specifies the remote Teradata user ID to which you are mapping MICHAEL. 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 Teradata data sources.

REMOTE_PASSWORD 'passxyz123'
Specifies the remote Teradata password that is associated with 'mike'. 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 Teradata 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 tera_server
       OPTIONS (REMOTE_AUTHID 'mike', REMOTE_PASSWORD 'passxyz123');