Cataloging a node and a database in an IBM DB2 Universal Database client

To access their respective IBM DB2 Universal Databases, both the Replication Agent for UDB and ECDA Option for ODBC must use IBM DB2 Universal Database client libraries. The process of cataloging configures an IBM DB2 Universal Database client so that it knows how to connect to a particular database. This process also creates a database alias, which Replication Agent or ECDA uses as the data source name.

By default, IBM DB2 Universal Database client libraries are installed when the IBM DB2 Universal Database server is installed. In addition, an IBM DB2 Universal Database client can be separately installed on a host other than the one on which the IBM DB2 Universal Database server is installed. In either case, cataloging must be performed in the IBM DB2 Universal Database client that Replication Agent or ECDA is using. If Replication Agent and ECDA are installed on different hosts, they are using different IBM DB2 Universal Database clients, so the cataloging must be performed in both of the IBM DB2 Universal Database clients.

If the IBM DB2 Universal Database client and the IBM DB2 Universal Database server are on the same host, and there is only one IBM DB2 Universal Database server running, cataloging may have been performed when the IBM DB2 Universal Database instance was installed and the databases configured. If so, then no further cataloging needs to be performed.

StepsCataloging a node in an IBM DB2 Universal Database client

  1. On UNIX or Linux, navigate to the IBM DB2 Universal Database server or IBM DB2 Universal Database client sqllib directory, which is located in the IBM DB2 Universal Database instance owner user home directory. For example, on UNIX:

    cd /db2home/db2inst1/sqllib
    
  2. On UNIX or Linux, set the IBM DB2 Universal Database environment variables by sourcing the appropriate script:

    • For C shell:

      source db2cshrc
      
    • For Bourne or Korn shell:

      . db2profile
      

    If necessary, log in to the operating system as the IBM DB2 Universal Database instance owner. Logging in sets up all the IBM DB2 Universal Database environment variables.

    NoteOn Windows, the IBM DB2 Universal Database installation sets up all necessary environment variables.

  3. Start the IBM DB2 Universal Database command line processor (CLP).

    • On UNIX or Linux, enter the following command:

      db2
      
    • On Windows, select Start | Programs | IBM DB2 | Command Line Tools | Command Line Processor.

  4. Determine if the desired IBM DB2 Universal Database node has already been cataloged. At the CLP prompt, enter:

    list node directory
    

    If a node has already been cataloged, depending on whether the node is local (first entry below) or remote (second entry below), you see results similar to this:

    Node 1 entry:
    
    
    
    Node name                  = DB2NODE1
    
    Comment                    =
    
    Directory entry type       = LOCAL
    
    Protocol                   = LOCAL
    
    Instance name              = DB2_01
    
    
    
    Node 2 entry:
    
    
    
    Node name                  = DB2NODE2
    
    Comment                    =
    
    Directory entry type       = LOCAL
    
    Protocol                   = TCPIP
    
    Hostname                   = 10.22.85.228
    
    Service name               = 50001
    
  5. If your desired node is not listed, catalog it at the CLP prompt.

    • To catalog a local node, issue this command:

      CATALOG LOCAL NODE node_name INSTANCE db2_instance_name
      

      where:

      • node_name is the name of the node on the local host.

      • db2_instance_name is the name of the associated DB2 instance.

    • To catalog a remote node, issue this command:

      CATALOG TCPIP NODE node_name REMOTE ip_address SERVER port_number
      

      where:

      • node_name is the name of the node on the remote host.

      • ip_address is either the IP address or name of the host on which the remote node is running.

      • port_number is the port on which the remote node is listening for client connections.

  6. Verify that the node has been cataloged by issuing the list node directory command again.

StepsCataloging a database in an IBM DB2 Universal Database client

  1. Determine if the database has already been cataloged. At the CLP command prompt, execute this command:

    list database directory
    

    Depending on whether the database is local (first entry below) or remote (second entry below), you see results similar to this:

    Database 1 entry:
    
    
    
    Database alias                       = GRP_DB
    
    Database name                        = GRP_DB
    
    Local database directory             = /db2home/db2inst1
    
    Database release level               = b.00
    
    Comment                              = UTF-8(Unicode DB)
    
    Directory entry type                 = Indirect
    
    Catalog database partition number    = 0
    
    Alternate server hostname            =
    
    Alternate server port number         =
    
    
    
    Database 2 entry:
    
    
    
    Database alias                       = DB1V9_DS
    
    Database name                        = DB1_V9
    
    Node name                            = DB2NODE2
    
    Database release level               = b.00
    
    Comment                              = 
    
    Directory entry type                 = Remote
    
    Catalog database partition number    = -1
    
    Alternate server hostname            =
    
    Alternate server port number         =
    
  2. If your desired database is not listed or does not have a database alias, catalog it at the CLP prompt.

    • To catalog a database using the default alias, which is the same as the database name:

      CATALOG DATABASE database_name AT NODE node_name
      

      where:

      • database_name is the name of either the primary or replicate database.

      • node_name is the name of the node that contains the database.

    • To catalog a database with a specific alias:

      CATALOG DATABASE database_name AS my_alias AT NODE node_name
      

      where:

      • database_name is the name of either the primary or the replicate database.

      • my_alias is your desired alias.

      • node_name is the name of the node that contains the database.

  3. Verify that the database has been cataloged by issuing the list database directory command again.

  4. To exit the DB2 CLP, enter the quit command.