You are on page 1of 9

DB2 Version 8 Connectivity Cheat Sheet Raul F.

Chong IBM Toronto Lab August 2003 Scenario 1 From DB2 Linux/Unix/Windows machine to DB2 Linux/Unix/Windows machine (no DB2 Connect) Machine 1 ('libra') Machine 2 ('mpower') Linux/UNIX/Windows Linux/UNIX/Windows Commands to run on this machine: Information you need to obtain from this machine, to perform the commands on machine 1: db2 catalog tcpip node For this example: mpwrnode mpower.ca.ibm.com = Host name of machine 2. remote 50000 = The port used for DB2. mpower.ca.ibm.com server 50000 To find out the port used, issue this command from the CLP: get dbm cfg Notes: Then, look for the parameter SVCENAME 'mpwrnode' is an arbitrary name chosen for the node. The IP address can be used instead of the hostname A service name defined in the services file of this client with a value of 50000 can be specified instead of the port number itself. If the value of SVCENAME is not the port number but a string, then look in your system for the file services and grep for this string, which is normally based on your DB2 instance name. For example, if your instance name is 'db2inst1', you will normally find a corresponding entry like this: db2cdb2inst1 50000/tcp The services file can be located at: /etc/services (UNIX) X:\WINNT\System32\drivers\etc\services (Windows) a42ds1 = Name of the database you want to access in machine 2.

db2 catalog db a42ds1 at node mpwrnode db2 terminate db2 connect to a42ds1 user <userid as defined on server machine 2> using <password as defined on server machine 2> What to check if you cannot connect: Client Machine 'libra' ping mpower.ca.ibm.com

Database Server 'mpower' mpower.ca.ibm.com = Host name of Database Server

ping 158.228.20.100

If you cannot ping there may be problems with the DNS. Try pinging the IP address 158.228.20.100 = IP address of Database Server This will confirm if there are problems or not with the network. Is DB2 started? If not run db2start Is DB2COMM set to TCPIP? Check by executing: db2set -all. If this registry variable is not set, you should execute: db2set db2comm=tcpip and then issue a db2stop/db2start to make sure the change takes effect. Is SVCENAME set to the port number or service name specified in the services file of this server machine? Check this parameter from the CLP by issuing: get dbm cfg

If you used a service name instead of the port number in your catalog tcpip command, make sure the entry is correct in the services file at the client machine. netstat -a -n Shows all connections and port numbers and their status. Issue this from your command prompt.

netstat -a -n Shows all connections and port numbers and their status. Issue this from your command prompt.

Scenario 2 From DB2 Linux/UNIX/Windows machine to DB2 for OS/390 and z/OS machine (DB2 Connect MUST be installed on the Linux/UNIX/Windows machine)

Machine 1 ('aries') Machine 2 ('bigblue') DB2 for OS/390 and z/OS Linux/UNIX/Windows Commands to run on this machine: Information you need to obtain from this machine, to perform the commands on machine 1: db2 catalog tcpip node For this example: bigbnode bigblue.ca.ibm.com = Host name of machine 2. remote bigblue.ca.ibm.com server 446 446 = The port used for DB2. Notes: 'bigbnode' is an arbitrary name chosen for the node.
DB2 Version 8 Connectivity Cheat Sheet

Port 446 is normally the default value. To find out the port used, contact your DB2 for OS/390 and z/OS DBA who can check the MVS syslog for message DSNL004I.
2

The IP address can be used instead of the hostname. A service name defined in the services file of this client with a value of 446 can be specified instead of the port number itself.
db2 catalog db d42d1 at node bigbnode authentication dcs db2 catalog dcs db d42d1 as s390loc

"TCPPORT" in that message contains the port to use. Also, the -DISPLAY DDF command provides this info.

'd42d1' is the name you will use to connect to the DB2 for z/OS and OS/390 subsystem. This name is chosen arbitrarily. s390loc = The LOCATION NAME of the DB2 subsystem you want to access on machine 2. To find out the LOCATION NAME, contact your DB2 for OS/390 DBA who can check the MVS syslog for message DSNL004I. "LOCATION" in that message contains the LOCATION NAME to use. Also, the -DISPLAY DDF command provides this info.

db2 terminate db2 connect to d42d1 user<userid> using <password> What to check if you cannot connect: Client Machine 'aries' Database Server 'bigblue' ping bigblue.ca.ibm.com bigblue.ca.ibm.com = Host name of Database Server If cannot ping, there may be problems with the DNS. Try pinging the IP address ping 158.228.20.3 158.228.20.3 = IP address of Database Server This will confirm if there are problems or not with the network. Make sure you have DB2 Connect Software installed by issuing the command db2licm -l from the CLP Since the Database server is DB2 UDB for OS/390 and z/OS, check: Is DB2 started? If not, execute -start db2 Is DDF started? If not, execute -start ddf If you used a service name instead of the port number in your catalog tcpip command, make sure the entry is correct in the services file at the client machine. netstat -a -n netstat
DB2 Version 8 Connectivity Cheat Sheet 3

Shows all connections and port numbers and their status. Issue this from your command prompt

Shows all connections and port numbers and their status. Issue this command from 'option 6 Command' in the main ISPF menu.

Scenario 3 From DB2 Linux/UNIX/Windows machine (client, machine 0) to DB2 Linux/UNIX/Windows machine (With DB2 Connect as a gateway, machine 1) to DB2 for OS/390 and z/OS machine (machine 2) From machine 1 to machine 2, follow the same instructions as in scenario 2 . There is no need to issue a catalog database command from the DB2 Connect gateway unless you want to connect from that machine. Machine 0 ('raven') Machine 1 ('aries') Linux/Unix/Windows Linux/Unix/Windows Commands to run on this machine: Information you need to obtain from this machine, to perform the commands on machine 0: db2 catalog tcpip node For this example: gatewayn aries.xyz.com = Host name of machine 1. remote aries.xyz.com 50010 = The port used for DB2. server 50010 Notes: - 'gatewayn' is an arbitrary name chosen for the node. - The IP address can be used instead of the hostname - A service name defined in the services file of this client with a value of 50010 can be specified instead of the port number itself. db2 catalog db d42d1 at node gatewayn authentication dcs_encrypt db2 terminate db2 connect to d42d1 user <userid for DB2 OS/390 and z/OS> using <password DB2 OS/390 and z/OS> What to check if you cannot connect: Client Machine 'raven'
DB2 Version 8 Connectivity Cheat Sheet

To find out the port used, issue this command from the CLP: get dbm cfg Then, look for parameter SVCENAME. If the value of SVCENAME is not the port number but a string, then look in your system for the file services and grep for this string, which is normally based on your db2 instance name. (Same explanation as scenario 1)

d42d1 = Name of the database you want to access as specified in the catalog dcs command in this gateway machine (machine 1).

Gateway (DB2 Connect Server) 'aries'


4

ping aries.xyz.com

ping 9.82.24.10

aries.xyz.com = Host name of Gateway Server If cannot ping, there may be problems with the DNS. Try pinging the IP address 9.82.24.10 = IP address of Gateway (DB2 Connect Server) This will confirm if there are problems or not with the network.

If you used a service name instead of the port number in your catalog tcpip command, make sure the entry is correct in the services file at the client machine. Try connecting from the Gateway to the Database Server (as shown in scenario 2). If you cannot connect, review your setup according to scenario 2. If you can connect, then the problem is definitively from the Client to the Gateway, thus review the setup on machine 0 according to figure 3. netstat -a -n Shows all connections and port numbers and their status. Issue this from your command prompt

netstat -a -n Shows all connections and port numbers and their status. Issue this from your command prompt

Scenario 4 From DB2 Linux/UNIX/Windows machine to DB2 for iSeries machine (DB2 Connect MUST be installed on the Linux/UNIX/Windows machine) Machine 1 ('aries') Machine 2 ('big400') DB2 for iSeries Linux/UNIX/Windows Commands to run on this machine: Information you need to obtain from this machine, to perform the commands on machine 1: db2 catalog tcpip node For this example: big4node big400.ca.ibm.com = Host name of machine 2. remote 446 = The port used for DB2. big400.ca.ibm.com server 446 Port 446 is the default value. In DB2 for iSeries, there is only one database per iSeries machine, thus it is very Note: unlikely the port is changed. 'big4node' is an arbitrary name chosen for the node. The IP address can be used instead of the hostname. A service name defined in the services file of this client
DB2 Version 8 Connectivity Cheat Sheet 5

with a value of 446 can be specified instead of the port number itself. db2 catalog db my400db at node big4node authentication dcs db2 catalog dcs db my400db as torisc6

'my400db' is the name you will use to connect to the DB2 iSeries database. This name is chosen arbitrarily. torisc6 = The local RDB Name. In order to determine the local RDB name contact your iSeries administrator who can issue the command: WRKRDBDIRE When the 'Work with Relational Database Directory Entries' panel appears, the administrator can find the desired value in column 'Relational Database' that maps to the column 'Remote Location' with a value of '*LOCAL'.

db2 terminate db2 connect to my400db user <userid as defined on server machine 2> using <password as defined on server machine 2> What to check if you cannot connect: Client Machine 'aries' Database Server 'bigblue' ping big400.ca.ibm.com big400.ca.ibm.com = Host name of Database Server If cannot ping, there may be problems with the DNS. Try pinging the IP address ping 9.89.168.6 9.89.168.6 = IP address of Database Server This will confirm if there are problems or not with the network. Make sure you have DB2 Connect Software installed by issuing the command 'db2licm -l' from the CLP Since the Database server is DB2 UDB for iSeries, check: Is DDM started? If not, execute: STRTTCPSVR SERVER(*DDM) If you used a service name instead of the port number in your catalog tcpip command, make sure the entry is correct in the services file at the client machine. netstat -a -n netstat

DB2 Version 8 Connectivity Cheat Sheet

Shows all connections and port numbers and their status. Issue this from your command prompt

Shows all connections and port numbers and their status. Issue this command from 'option 6 Command' in the main ISPF menu.

Scenario 5 From DB2 Linux/UNIX/Windows machine (client, machine 0) to DB2 Linux/UNIX/Windows machine (With DB2 Connect as a gateway, machine 1) to DB2 for iSeries machine (machine 2) From machine 1 to machine 2, follow the same instructions as in scenario 4 . There is no need to issue a catalog database command from the DB2 Connect gateway unless you want to connect from that machine. Machine 0 ('raven') Machine 1 ('aries') Linux/Unix/Windows Linux/Unix/Windows Commands to run on this machine: Information you need to obtain from this machine, to perform the commands on machine 0: db2 catalog tcpip node For this example: gatewayn aries.xyz.com = Host name of machine 1. remote aries.xyz.com 50010 = The port used for DB2. server 50010 Notes: 'gatewayn' is an arbitrary name chosen for the node. The IP address can be used instead of the hostname A service name defined in the services file of this client with a value of 50010 can be specified instead of the port number itself. db2 catalog db my400db at node gatewayn authentication dcs_encrypt db2 terminate db2 connect to my400db user <userid for iSeries> using <password for iSeries> To find out the port used, issue this command from the CLP: get dbm cfg Then, look for parameter SVCENAME. If the value of SVCENAME is not the port number but a string, then look in your system for the file services and grep for this string, which is normally based on your db2 instance name. (Same explanation as scenario 1)

my400db = Name of the database you want to access as specified in the catalog dcs command in this gateway machine (machine 1).

What to check if you cannot connect: Client Machine 'raven' Gateway (DB2 Connect Server) 'aries' ping aries.xyz.com aries.xyz.com = Host name of Gateway Server If cannot ping, there may be problems with the DNS. Try pinging the IP address
DB2 Version 8 Connectivity Cheat Sheet 7

ping 9.82.24.10

9.82.24.10 = IP address of Gateway (DB2 Connect Server) This will confirm if there are problems or not with the network.

If you used a service name instead of the port number in your catalog tcpip command, make sure the entry is correct in the services file at the client machine. Try connecting from the Gateway to the Database Server (as shown in scenario 2). If you cannot connect, review your setup according to scenario 2. If you can connect, then the problem is definitively from the Client to the Gateway, thus review the setup on machine 0 according to figure 5. netstat -a -n Shows all connections and port numbers and their status. Issue this from your command prompt

netstat -a -n Shows all connections and port numbers and their status. Issue this from your command prompt

Other related commands that you may want to use (These commands are not applicable to the DB2 for OS/390 and z/OS server or iSeries server): Command Command Description Where to execute the Command db2 list db Lists the databases you have At all machines directory catalogued db2 list node Lists the node directories you have At the DB2 UDB Client and DB2 directory catalogued Connect Server db2 list dcs Lists the dcs databases you have At the DB2 Connect Server directory catalogued db2 uncatalog Uncatalogs a database entry (in At all machines database <dbname> case you incorrectly catalogued a database) db2 uncatalog Uncatalogs a dcs database entry At the DB2 Connect Server dcs database <dbname> db2 uncatalog Uncatalogs a node entry At the DB2 UDB Client and DB2 node <node name> Connect Server db2licm -l Lists which DB2 product(s) you At all machines have installed and licensed db2 ? <command Displays the syntax to use for At all machines name> <command name> Eg: db2 ? catalog ==> Will show the syntax of the 'catalog' command
DB2 Version 8 Connectivity Cheat Sheet 8

Typical connectivity error messages Error Message


SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "". Communication function detecting the error: "connect". Protocol specific error code(s): "10060", "*", "*". SQLSTATE=08001 SQL30082N Attempt to establish connection failed with security reason "24" ("USERNAME AND/OR PASSWORD INVALID"). SQLSTATE=08001

Description This is a generic message which basically tells you that your connectivity setup is not correct. Review your setup according to any of the five scenarios described. (There may be slight variations to the message, but normally it is a connectivity configuration issue. It may take a few seconds to receive the message after issuing a connect. This depends on the socket timeout set at your system. This message will display if you are using an incorrect user id or password.

Trademarks The following terms are trademarks of IBM Corporation in the United States and/or other countries: IBM, DB2, DB2 Connect, DB2 Universal Database, iSeries, OS/390, z/OS UNIX is a registered trademark of The Open Group in the United States and other countries. Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both. Other company, product or service names may be the trademarks or service marks of others.

Copyright International Business Machines Corporation 2003. All rights reserved.

DB2 Version 8 Connectivity Cheat Sheet

You might also like