Cataloging the Db2 database

You can remotely catalog the Db2 database by running CLP or CLPPlus commands.

The following variables are used in the catalog commands:

Table 1. Variables that are used in the catalog commands
Variable Description
host_name_or_IP_address The hostname or IP address of the IBM Software Hub instance.
db2_ssl_port The port number of the Db2 secure sockets layer (SSL) instance.
db2_port The port number of the Db2 instance.
database_name The name of the Db2 database.
database_alias_name The alias name of the remote Db2 database.
server_alias_name The alias for the remote server of the Db2 instance.
authentication_method The authentication method for connecting to the remote database.
  • For username and password, use SERVER_ENCRYPT.
  • For access token and API key, use GSSPLUGIN.

CLP

You can catalog the remote database by using the CLP either with or without SSL.

With SSL

Run the following command to catalog the remote database by using the CLP with SSL

db2 catalog tcpip node server_alias_name remote host_name_or_IP_address server db2_ssl_port security SSL 
db2 catalog db database_name as database_alias_name at node server_alias_name authentication authentication_method
Without SSL

Run the following command to catalog the remote database by using the CLP without SSL This command is supported for username and password only.

db2 catalog tcpip node server_alias_name remote host_name_or_IP_address server db2_port
db2 catalog db database_name as database_alias_name at node server_alias_name authentication authentication_method

CLPPlus

For CLPPlus to connect to a Db2 server by using IBM Software Hub authentication, you must configure a data source name (DSN) first in a db2dsdriver.cfg configuration file.

Run the following command.

db2cli writecfg add -dsn dsn_alias -database database_name -host host_name_or_IP_address -port db2_ssl_port -parameter "parameter"

Where parameter is one of the following values:

Authentication=GSSPLUGIN
Used for non-SSL connections, which require a username and password.
SecurityTransportMode=SSL
Used for SSL connections.

The db2dsdriver.cfg configuration file is an XML file, typically located in the sqllib/cfg directory, that contains a list of DSN aliases and their properties. The following example of a db2dsdriver.cfg configuration file shows the configurations that are used to establish a connection to a database service instance. The configuration file provides the DSN alias, the database name, the hostname (or IP address), and the Authentication and SecurityTransportMode parameter values:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<configuration>
	<dsncollection>
		<dsn alias="<data_source_name>" name="database_name" host="host_name_or_IP_address" port="db2_ssl_port">
			<parameter name="Authentication" value="authentication_method"/>
			<parameter name="SecurityTransportMode" value="SSL"/>
		</dsn>
	</dsncollection>
	<databases>
		<database name="database_name" host="host_name_or_IP_address" port="db2_ssl_port"/>
	</databases>
</configuration>

For more details about connecting to DSN aliases with CLPPLUS, see DSN aliases in CLPPlus.