CREATE USER MAPPING statement - Examples for the BioRS wrapper

Use the CREATE USER MAPPING statement to map a federated server user ID to a BioRS server user ID and password.

You can create a user mapping by specifying a guest user account, an authenticated user account, the USER special register, or a proxy server.

Creating a user mapping for a guest user account

The GUEST user option specifies if the BioRS wrapper should use a guest account to access the BioRS server.

The following example shows how to specify that a guest user account is used to access the BioRS server:
CREATE USER MAPPING FOR DB2INST1 SERVER biors_server
      OPTIONS (GUEST 'Y');
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 biors_server
Specifies the server definition name that you registered in the CREATE SERVER statement for the BioRS server.
GUEST 'Y'

Specifies that the BioRS wrapper uses a guest user account to authenticate this user.

Creating a user mapping for an authenticated user account

The following example shows how to map a federated server user ID to a BioRS server user ID and password:
CREATE USER MAPPING FOR DB2INST1 SERVER biors_server
      OPTIONS (REMOTE_AUTHID 'charlene',
      REMOTE_PASSWORD 'all4one');
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 biors_server
Specifies the server definition name that you registered in the CREATE SERVER statement for the BioRS server.
REMOTE_AUTHID 'charlene'
Specifies the user ID at the BioRS server to which you are mapping charlie. This remote ID must be in a format that is expected by the BioRS server.
REMOTE_PASSWORD 'all4one'
Specifies the password that is associated with 'charlene'.

Creating a user mapping by using a special register

You can use the federated database 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 biors_server
       OPTIONS (REMOTE_AUTHID 'charlene', REMOTE_PASSWORD 'all4one');

Creating a user mapping for a proxy server

The following example shows how to map a federated server user ID to a BioRS server user ID and password:

To register a server definition and specify a SOCKS proxy server with authentication information, use the following statement:
CREATE USER MAPPING FOR DB2INST1 SERVER biors_proxy
      OPTIONS (REMOTE_AUTHID 'charlene', 
      REMOTE_PASSWORD 'all4one'
      PROXY_AUTHID 'chuck'
      PROXY_PASSWORD 'them2us');
PROXY_AUTHID 'chuck'
Specifies the user ID on the proxy server. This user mapping option is required when the proxy server requires authentication.
PROXY_PASSWORD 'them2us'
Specifies the password on the proxy server that is associated with the user name 'chuck'. This user mapping option is required when the proxy server requires authentication.