Installation
Windows Installation
To execute the installation the user must start the executable “SubsetSetup-<version>.exe”. The following screens will be presented:
License
After launching DATPROF Subset for the first time, a license key needs to be entered before you can use Subset.
The license is stored in the file “dpfsub.lic”, located in the folder specified below:
Installing for DB2 for Linux, Unix or Windows
To enable DATPROF Subset for DB2 for LUW, specific actions must be performed on the Database Server platform.
DATPROF Subset utilizes IBM Federation facilities to connect two database schemas across the network.
Steps to enable Federation:
A Node must be created.
Federation must be active.
A DRDA Wrapper must be created.
A Server should be specified using this wrapper.
To use this server a User Mapping must be defined.
DATPROF Subset utilizes this setup to create what are known as Nicknames for all remote tables.
This configuration is typically handled by a DBA on the machine where the target database is defined as a Federated server. Below are the steps involved, along with brief explanations:
Add a Node
To connect two machines Federation uses a so called Node. To create a Node follow this instruction
Create a node
db2 catalog tcpip node {node-name} remote {ip|host} server {port}
An example of creating a node
db2 catalog tcpip node remnode remote 192.100.20.10 server 50000
To check your node, execute the following command: db2 list node directory
Then create an alias to the remote database (the data source)
To do this use this command:
Create an alias to the remote database
db2 catalog db {remote-databasename} as {local-alias} at node {node-name}
An example of creating an alias
db2 catalog db CRM_01 as localias at node srcnode
Following these commands a refresh of the Directory cache is required. To do this use this command:
Refreshing the Directory Cache
db2 terminate
Beware that all active connections will be closed.
Enable Federation
To enable Federation the owner of the local DB2 instance should execute the following commands:
Enabling Federation
db2 update database manager configuration using federated yes
db2stop
db2start
Create a DRDA Wrapper
A wrapper is an alias for the protocol used. DATPROF Subset uses the “DRDA” (Distributed Relational Database Architecture) protocol.
A database user with the DBADM Role should connect to the target database to issue the following command to create the wrapper.
(For instance the db2inst1 user connects to the target database )
Creating a wrapper
create wrapper {custom-name} library db2drda.(so|dll)
An example of creating a wrapper
create wrapper drda
DRDA is the default protocol for a connection between two DB2 databases. Creating a wrapper is a one-time action which can be reused by other users.
Create a Server
To have a connection between two Database Instances a “Server” is required.
A database user with the DBADM Role should connect to the target database to issue the following command to create this Server:
(For instance the db2inst1 user connects to the target database )
Creating a server
create server {server-name}
type db2/udb
version {database version (10.5)}
wrapper {wrapper-name (drda)}
authid {remote-username}
password "{remote-password}"
options(dbname '{local-alias}');
An example of creating a server
create server srcserver
type db2/udb
version 10.5
wrapper drda
authid MyRemoteUser
password "MyRemotePassword"
options(add dbname 'localias');
This example creates a named connection between the local (Target) database instance where the query will be executed and the remote (Source) database instance where the data is read from. This is also a one-time action and the Server can be reused by other users.
The User and Password specified are only required to register the connection.
The name of this Server is the Server Name DATPROF Subset requires you to enter in the project settings screen.
Create a User Mapping
After the valid Server is created a connected Database user can setup a mapping between a Local user and a Remote user.
Whenever a local user executes a query using this User Mapping the permissions granted to the Remote User apply.
This is how to create a User Mapping:
Create user mapping
create user mapping for {local-username}
server {server-name}
options (remote_authid '{remote-username}',remote_password '{remote-password}');
An example of creating user mapping
create user mapping for LocalUser
server sDataServer
options (remote_authid 'RemoteUser',remote_password 'RemotePassword’);
Nicknames
At this point the Federation is setup and active and DATPROF Subset can access objects in the remote database. For every Remote table DATPROF Subset will create a Nickname.
Every table is Prefixed with “DSB_” : DSB_<OriginalTableName>
The Nicknames must be used in user-generated SQL scripts whenever references are made to remote tables. This ensures that the Federated server can correctly identify and access the remote tables, allowing the SQL queries to execute seamlessly across different databases.