User Guide
Connecting to DB2 Databases 17
You perform the following steps:
• Set environment variables.
• Catalog a TCP/IP node.
• Catalog the database.
• Test the connection.
You should be familiar with DB2 to successfully complete this process. Gather the
following information before you begin:
• Host name where the DB2 database server resides
• Node name
• Database name
• Database alias
• Database user id and password
• Service name from the /etc/services file on client and host
Set environment variables
After you install the Client Enabler, you need to run some scripts to set up your
environment. You must also set environment variables to run the command line tool
db2.
Look in the <installdir>/sqllib directory for the db2profile and db2cshrc scripts.
• For sh or ksh, run:
<installdir>/sqllib/db2profile
• For csh, run:
source <installdir>/sqllib/db2cshrc
Catalog a TCP/IP node
You must add an entry to the client’s node directory to describe the remote node.
This entry specifies the chosen alias (node_name), the hostname (or ip_address),
and the servicename (or port_number) that the client will use to access the remote
server.
To catalog a TCP/IP node:
1 Run the db2 command line utility db2.
2 At the db2 prompt, enter the following:
db2 => catalog tcpip node dbserver1node remote db2unixhost server
db2server1
db2 =>terminate
Catalog the database
Before a client application can access a remote database, the database must be
cataloged on the server node and on any client nodes that will connect to it. When