Question & Answer
Question
Answer
To configure a federation access to Db2 LUW data source through JDBC wrapper, you must provide federation with information about the data sources and objects that you want to access. Then create server, user mapping and nicknames for tables in remote Db2 data source.
Before you begin
Check drivers db2jcc4.jar and db2jcc_license_cisuz.jar in the path $/INSTANCE_HOME/sqllib/java.
1. Enable Federation server and restart Db2.
$ db2 update dbm cfg using federated YES
$ db2stop force
$ db2start
2. Test the connection to the Db2 data source and verify the service is started correctly.
telnet <db2_ip> <port>
If the connection is successful, you will receive following output.
$ telnet 9.30.231.74 50000
Trying 9.30.231.74...
Connected to 9.30.231.74.
Escape character is '^]'.
If the connection fails, you will receive an error, please check the Db2 service status.
3. Create server, user mapping, nickname and query the nickname.
$ connect to testdb
$ CREATE SERVER server1 type JDBC version 11 options (DRIVER_PACKAGE '/home/db2inst1/sqllib/java/db2jcc4.jar:/home/db2inst1/sqllib/java/db2jcc_license_cisuz.jar', driver_class 'com.ibm.db2.jcc.DB2Driver', url 'jdbc:db2://snore1.fyre.ibm.com:50008/testdbu')
$ create user mapping for user server SERVER1 options (REMOTE_AUTHID 'db2inst8', REMOTE_PASSWORD 'DVM_test123')
$ CREATE NICKNAME nk1 FOR SERVER1.db2inst8.test1
$ select * from nk1
col_1
--------------------------
1970-11-23-12.12.12.000000
1999-12-31-12.12.12.000000
2 record(s) selected.
Was this topic helpful?
Document Information
Modified date:
15 April 2021
UID
ibm16441695