copyright | lastupdated | keywords | subcollection | ||
---|---|---|---|---|---|
|
2021-04-15 |
Db2onCloud |
{:external: target="_blank" .external} {:shortdesc: .shortdesc} {:codeblock: .codeblock} {:screen: .screen} {:tip: .tip} {:important: .important} {:note: .note} {:deprecated: .deprecated} {:pre: .pre}
{: #fedv2_cld_to_cld}
Federation allows you to communicate with one or more local or remote databases.
The following steps are required to configure the federation system:
- Database and host name layout
- Create the wrapper
- Create the server for a remote database
- Create the user mapping
- Create a nickname
{: #fedv2_db_hn}
Target database where the remote table must show:
Hostname : <target_host_name>
DB2 Version: v11.5
Database Name: BLUDB
Schema Name: <schema_name>
Remote database where the table is present:
Hostname : <remote_host_name>
DB2 Version: v11.5
Service/Port Number: <port>
User: <remote_user>
Password: <remote_password>
Database Name: BLUDB
Schema Name: TESTDB
Table Name: TEST1
{: #fedv2_wrapper}
Create a wrapper by running the following command from the console of the target database instance:
create wrapper drdawrapper library 'libdb2drda.so' options(DB2_FENCED 'Y')
{: codeblock}
DB20000I The SQL command completed successfully.
{: #fedv2_serv_remote_db}
Create a server to host the remote database by running the following command from the console of the target database instance:
create server fed_server type DB2/UDB version 11 wrapper drdawrapper authorization "<remote_user>" PASSWORD "<remote_password>" options(host '<remote_host_name>', port '<port>', dbname 'bludb', security 'SSL', password 'y')
{: codeblock}
DB20000I The SQL command completed successfully.
{: #fedv2_user_map}
Create the user mapping by running the following command from the console of the target database instance:
create user mapping for user server fed_server OPTIONS (remote_authid '<remote_user>', remote_password '<remote_password>')
{: codeblock}
DB20000I The SQL command completed successfully.
{: #fedv2_nick}
Create a nickname for the remote database and test the nickname by running the following commands from the console of the target database instance:
create nickname rmttest1 FOR fed_server.testdb.test1
{: codeblock}
DB20000I The SQL command completed successfully.
select * from rmttest1
{: codeblock}
C1 C2
----------- -----------
13 32
1 record(s) selected.