Cataloging remote servers and databases
After a server is configured for communications, all clients that wish to access the database on the server must be configured to communicate with the server. After that entries from the server and the remote database must be added to the system database and node directories on the client. If the client intends to connect to a System z or System i database via DB2 Connect, entries must also be added to the DCS directory. This is done through a process called cataloging, in which entries are added to DB2's directories.
Most users never have to be concerned with the cataloging process since databases
are cataloged implicitly upon creation. But, if you intend on accessing a
database stored on a remote server, you must get familiar with the
process of cataloging DB2 databases. It can be done using Data Studio or by
CATALOG DATABASE command.
Listing 1. Cataloging a database syntax
CATALOG [DATABASE | DB] [DatabaseName] <AS [Alias]> <ON [Path] | AT NODE [NodeName]> <AUTHENTICATION [AuthenticationType]> <WITH "[Description]">
Table 1. Cataloging a database attributes
|Name assigned to database being cataloged||Alias assigned to database when cataloged||Location (drive or directory) where directory hierarchy and files associated with the database to be cataloged are physically stored||Node where database to be cataloged resides; should match an intro in node directory file||Identifies where and how authentication is to take place when user attempts to access the database||Comment describing the database entry to be made in the database directory for the database to be cataloged (must be enclosed in quotation marks)|
Example: To catalog a database physically residing in
directory /home/db2info and has been given the name DUMMY_DB, execute the
CATALOG DATABASE command:
CATALOG DATABASE dummy_db AS test ON /home/db2info AUTHENTICATION SERVER
The process involved in cataloging nodes (servers) is different from the one used
to catalog databases. Usually, nodes are implicitly cataloged when a remote
database is cataloged via Data Studio. To explicitly catalog a node (server) you
can execute the
CATALOG … NODE command that corresponds
to the communications protocol being used to access the server being cataloged.
There are different forms of the command, including:
CATALOG LOCAL NODE
CATALOG LDAP NODE
CATALOG NAMED PIPE NODE
CATALOG TCPIP NODE
The syntax for these commands are similar except that many options
available are specific to the communications protocol for
which the command is tailored. Since TCP/IP is the most common communication
protocol used, we'll look at the syntax for that form of the
Listing 2. Cataloging a remote server syntax
CATALOG <ADMIN> [TCPIP | TCPIP4 | TCPIP6] NODE [NodeName] REMOTE [IPAddress | HostName] SERVER [ServiceName | PortNumber] <SECURITY SOCKS> <REMOTE INSTANCE [InstanceName]> <SYSTEM [SystemName]> <OSTYPE [SystemType]> <WITH "[Description]">
Table 2. Cataloging remote server attributes
|Alias to be assigned to the node to be cataloged||IP address of the server where the remote database you are trying to communicate with resides (IPv4/IPv6)||Host name as it is known to the TCP/IP network (the name of the server where remote database you are trying to communicate with resides)||Service name that the DB2 Database Manger instance on the server uses to communicate||Port number the DB2 Database Manager instance on the server uses to communicate||Name of the server instance to which an attachment is to be made||DB2 system name used to identify the server workstation||Type of OS being used on the server workstation (AIX®, Windows®, HP-UX, Sun, OS/390®, OS/400®, VM, VSE, and Linux®)||Comment used to describe the node entry to be made in the node directory for the node being cataloged (must be enclosed in quotation marks)|
Either the remote TCP/IP hostname or the remote IP address can be used to catalog a node. Similarly, the remote TCP/IP service name or the remote TCP/IP port number can be used when cataloging a node.
Example 1: To catalog a node for an AIX server named DB2HOST that has a DB2 instance named DB2INST1 that listens on port 60001, and assign it the alias REMOTE_SV, execute the following command:
CATALOG TCPIP NODE remote_sv REMOTE db2host SERVER 60001 OSTYPE AIX WITH "A remote AIX TCP/IP node"
Example 2: To catalog a node for a Linux server that has the IPv4 address 188.8.131.52 and a DB2 instance named DB2INST1 listening on port 50001, and assign it the alias SERVER1, you can do so by executing a command that looks like this:
CATALOG TCPIP4 NODE server1 REMOTE 184.108.40.206 SERVER 50001 OSTYPE LINUX
More examples are available: Configuring client-to-server connections using the command line processor.
Cataloging a Database Connection Services (DCS) database is similar to cataloging
a regular DB2 database. To catalog the database, you use the
CATALOG DCS DATABASE command with the following syntax:
CATALOG DCS DATABASEcommand syntax
CATALOG DCS [DATABASE | DB] [ALIAS] <AS [TargetName]> <AR [LibraryName]> <PARMS "[ParameterString]"> <WITH "[Description]">
CATALOG DCS DATABASEattributes
|Alias of the target database to be cataloged||Name of the target host database to be cataloged||Name of the application requester library to be loaded and used to access the remote database listed in the DCS directory (must be enclosed in quotation marks)||Parameter string to be passed to the application requester when invoked||Comment describing the database entry to be made in the DCS directory for the database to be cataloged (must be enclosed in quotation marks)|
Example: To catalog a DB2 for z/OS database residing in the
TEST_DB subsystem on the z/OS server that has the name INFO and assign it the
alias DATA_SYS, you could do so by executing a
CATALOG DCS DATABASE command:
CATALOG DCS DATABASE data_sys AS test_db WITH "DB2 for z/OS LOCATION NAME TEST_DB"
More information is available: Configuring client-to-server connections using the command line processor.