6.3. Supported Connectivity Scenarios
In this section, we discuss the following four connectivity scenarios in detail.
- Scenario 1: Local connection from a DB2 client to a DB2 server
- Scenario 2: Remote connection from a DB2 client to a DB2 server
- Scenario 3: Remote connection from a DB2 client to a DB2 host server
- Scenario 4: Remote connection from a DB2 client to a DB2 host server through a DB2 Connect gateway
A DB2 host server can be DB2 for z/OS, OS/390, or iSeries.You can configure a database connection by either:
- Cataloging the DB2 directories using DB2 commands manually
- Using the Configuration Assistant (CA) GUI tool
The Configuration Assistant is explained in section 6.4, Configuring Database Connections Using the Configuration Assistant.It is useful to understand how to manually populate the DB2 directories using DB2 commands, so these scenarios focus on using the commands. Once you know how to do this, it will be a breeze to perform the configuration with the Configuration Assistant.
6.3.1. Scenario 1: Local Connection from a DB2 Client to a DB2 Server
Figure 6.10 illustrates a local connection.
Figure 6.10. The process of connecting locally from a DB2 client to a DB2 Server
[View full size image]

- DB2 Personal Edition
- DB2 Workgroup Edition
- DB2 Express Edition
- DB2 Enterprise Server Edition
The database must exist in the server's system database directory with an entry type of Indirect .When you create a database with the create database command, an entry is automatically created in the system database directory and the local database directory. You normally do not need to issue catalog commands for a local database. However, it is possible for a local database to get lost in the system database directory. For example, this can happen if someone issues the uncatalog database command to remove the database from the system database directory, or when the system database directory is reset when reinstalling DB2. In all cases, as long as the database was not dropped (either by the drop database command or using the Control Center), the database still physically exists on the system, and the entry in the system database directory is simply missing. To get the database back into the system database directory, use this command:
where:drive (Windows)/path (UNIX) is the location where the database files are physically stored.Once the database is cataloged, you can use it just like before.NOTEIf you drop an instance, the databases that belong to this instance are not dropped, because the databases reside on different directories from that of the instance. To recover these databases, all you need to do is to create a new instance with the same name as the one dropped and catalog the databases back using the catalog db command.
catalog db database_name [as database_alias ] [on drive/path ]
6.3.2. Scenario 2: Remote Connection from a DB2 Client to a DB2 Server
In most cases you do not have the authority to log on to the database server to perform a local database connection. Database servers are set up so that connections are performed through DB2 clients. In this scenario, DB2 client code is installed on a different machine from the database server machine. The connect statement is issued from the DB2 client machine. Figure 6.11 shows a connection from the machine Libra to a remote DB2 server that resides on Aries .
Figure 6.11. The process of connecting remotely from a DB2 client to a DB2 server
[View full size image]

- DB2 Client (Runtime, Administration, or Application Development Client)
- DB2 Personal Edition
- DB2 Workgroup Edition
- DB2 Express Edition
- DB2 Enterprise Server Edition
The server must have one of the following installed:
- DB2 Workgroup Edition
- DB2 Express Edition
- DB2 Enterprise Server Edition
The supported communication protocols are
• TCP/IP | |
• NetBIOS | (only if both the client and server are Windows) |
• Named Pipes | (only if both the client and server are Windows) |
1. | Enable the database server to accept client connections. |
2. | Catalog the node directory and the system database directory on the client. |
The following sections describe these steps.
6.3.2.1 Enabling the Database Server to Accept Client Connections
Clients connect to the database server across the network using TCP/IP, NetBIOS (Windows only), or Named Pipes (Windows only). The server must have a process that is constantly up and running to receive these connect requests. We call this process a listener because it "listens" to any request that comes in from the network and tells the database manager to serve it.
6.3.2.1.1 TCP/IP connection
You need to perform the following steps on the database server to set up the listener if you are using the TCP/IP communication protocol.
1. | Update the services file to reserve a TCP/IP port for the DB2 instance.On Linux/UNIX, the services file is located in /etc/services.On Windows, the services file is located in C:\Windows\System32\drivers\etc\services.The entry in the services file must look like this:where:service_name is an arbitrary name to associate with the port number.port_number is the TCP/IP port number you are going to reserve for this DB2 instance.The port number must not already exist in the services file, and it must have a value of 1024 or higher. |
2. | Update the SVCENAME parameter in the Database Manager Configuration file.Log on as the local administrator (Windows) or the instance owner (Linux/UNIX) and issue the following command from the Command Line Processor:You need to specify either the port number or the service name you defined in step 1. |
3. | Enable TCP/IP support for the instance. Issue the following command:
|
4. | Restart the instance to make the changes you made in the previous steps effective. Issue db2stop and db2start . |
NOTEIf you are working with the default instance created and configured by the DB2 Setup Wizard, the services file, SVCENAME, and the DB2COMM parameters are already correctly configured.
6.3.2.1.2 NetBIOS or Named Pipes Connection
NetBIOS and Named Pipes are supported when the client and the server are on Windows platforms only. When NetBIOS or Named Pipes are used, you need to execute the following steps to set up the server.
6.3.2.2 Cataloging the Node Directory and Database Directory on the Client
After enabling the server to accept client connections, you need to tell the client how to connect to the server. You do this by cataloging the node directory and the system database directory at the client.
6.3.2.2.1 TCP/IP Connection
Use the information in Table 6.2 for completing the procedure in this section.
1. | Catalog a TCP/IP node on the client:
|
2. | Catalog a database directory on the client:
|
3. | Issue a terminate command to refresh the cache:
|
Parameter | Description | Sample Values |
---|---|---|
Host name or IP address | The host name or IP address of the remote server. If you are working on a DPF system, you can use any of the participating server's host names or IP addresses. | aries.myacme.com9.82.24.88 |
Port number | The TCP/IP port number where the instance is listening for incoming connections on the server. | 50000 |
Node name | An arbitrary name used to identify the remote server. It must be unique in the client's node directory. | mynode1 |
Database name | The database on the server. It is the database to which you want to connect. | RMTDB |
Database alias (optional) | An alias for the database name. If specified, all connections must use this alias. If not specified, the database alias will be the same as the database name. | MYRMTDB |
Information You Need to Obtain from Server Machine 2 ( Aries ) to Perform the Commands on Client Machine 1 | Command to Run on Client Machine 1 ( Libra ) |
---|---|
Host name = aries.myacme.com TCP/IP port in services file = 50000 |
|
Database alias on Machine 2 = RMTDBNote : The database must exist in the system database directory of Machine 2. If the database alias and the database name are different, then the database alias should be used. | Note : MYRMTDB is an alias to the database RMTDB . It is optional; if specified, the alias is what you should use in the connect command. Otherwise, use the database name. |
No information needed. | Note : This command is needed to make the previous catalog commands effective. |
A valid user ID and password that has CONNECT privileges to database RMTDB. This user ID will be used from Machine 1 to connect to RMTDB. |
|
Figure 6.12. Sample client's system database directory and node directory for remote connection to a DB2 database

6.3.2.2.2 NetBIOS Connection
If you are using NetBIOS, use the information in Table 6.4 to catalog a NetBIOS node.
1. | Issue the command:where:nodename is an arbitrary name and it must be unique in the client's node directory. |
2. | Continue with step 2 in section 6.3.2.2.1, TCP/IP Connection, to finish cataloging the database. |
Parameter | Description | Sample Value |
---|---|---|
NNAME of server | The NetBIOS name of the server workstation. You can get this from the server's Database Manager Configuration file using the get dbm cfg command. | server1 |
NNAME of client | The NetBIOS name of the client workstation. NNAME must be unique among all NetBIOS nodes in the network. You need to choose a name and update the client's Database Manager Configuration file using the update dbm cfg command. | client1 |
Adapter number | The client's logical adapter number used to connect to the DB2 server. To determine the adapter number:
Ensure that both ends of the connection are using the same emulation. | 2 |
6.3.2.2.3 Named Pipes Connection
If you are using Named Pipes as the communication protocol, use the worksheet in Table 6.5 to catalog an NPIPE node.
1. | Issue the command:where:nodename is an arbitrary name. It must be unique in the client's node directory. |
2. | Continue with step 2 in section 6.3.2.2.1, TCP/IP Connection, to finish cataloging the database. |
Parameter | Description | Sample Value |
---|---|---|
Computer name | The computer name of the server. On the server machine, click on Start > Settings > Control Panel . Double-click on the Network folder and select the Identification tab. Record the computer name. | db2server1 |
Instance name | The name of the DB2 instance on the server. | DB2 |
6.3.3. Scenario 3: Remote Connection from a DB2 Client to a DB2 Host Server
Figure 6.13 illustrates the configuration used for this scenario. The machine aries is considered a client to the database server mpower .
Figure 6.13. The process of connecting remotely from a DB2 client to a DB2 host server

- DB2 Connect Personal Edition
- DB2 Connect Enterprise Edition
- DB2 Enterprise Server Edition
The communication protocols supported are
- TCPIP
- APPC
Setting up a remote connection to a host DB2 database follows the same principle as setting up a connection to a DB2 for Linux, UNIX, and Windows database. You need to configure both the client and the server.
3. | Enable the database server to accept client connections. |
4. | Catalog the node directory, system database directory, and DCS directory on the client. |
6.3.3.1 Enabling the Database Server to Accept Client Connections
For DB2 for z/OS and OS/390, make sure that the distributed data facility (DDF) is running on the mainframe. DDF is the facility in DB2 for z/OS and OS/390 that allows for remote communication support. You can verify this by issuing the -display ddf command from the mainframe. To start DDF, issue the -start ddf command.For DB2 for iSeries, make sure the distributed data management (DDM) is started. DDM is the facility in DB2 for iSeries that allows for remote communication support. To start DDM from the iSeries server or to verify that DDM is already started issue
The TCPIP port 446 is usually the default value. APPC can also be used instead of TCP/IP. Contact your host database administrator for specific connection information.
STRTTCPSVR SERVER(*DDM)
6.3.3.2 Cataloging the Node Directory, Database Directory, and DCS Directory on the Client
After you have enabled the server to accept client connections, you need to tell the client how to connect to the server. You do this by cataloging the node directory, system database directory, and DCS directory on the client.
6.3.3.2.1 TCP/IP Connection
Use the information in Table 6.6 for completing the procedure in this section.
1. | Catalog a TCP/IP node on the client.
|
2. | Catalog a database directory on the client.
|
3. | Catalog a DCS database directory on the client by issuing the following command from the client's command window:The database_name field must match the database_name in the catalog db command in step 2. |
4. | Issue the terminate command to refresh the cache.
|
Parameter | Description | Sample Values |
---|---|---|
Host name or IP address | The host name or IP address of the remote server. | mpower.youracme.com158.228.10.3 |
Port number | The TCP/IP port number on which DB2 is listening for incoming connections on the server. | 446 |
Node name | This is an arbitrary name and is used to identify the remote server. It must be unique in the client's node directory. | mynode2 |
Target database name | The database on the host server. For DB2 for z/OS and OS/390 servers, this is the Location name . For DB2 for iSeries servers, this is the RDB name . | hostprod |
Database name | An arbitrary name you would like to associate with the target database name. | myhostdb |
Database alias (optional) | You can optionally specify a database alias for the database name. If specified, all connections must use this alias name; if not specified, the database alias will be the same as the database name. | myhostdb |
Figure 6.15. The process of connecting from a DB2 client to a DB2 server via a DB2 Connect gateway
[View full size image]

Figure 6.14. Sample client's system database directory, node directory, and DCS directory for remote connection to a DB2 host database
[View full size image]

6.3.3.2.2 APPC Connection
If you use APPC instead of TCP/IP, you need to do more work on the client. In addition to cataloging the node, database, and DCS directories, you also need to configure the APPC software installed on the client. Table 6.8 lists the supported APPC software. Please refer to the APPC software manual for instructions on how to configure this software.
Platform | Software Needed to Support APPC Connection |
---|---|
Windows NT/2000 | IBM Communications Server Version 6.1.1 or laterIBM Personal Communications for Windows Version 6.0 with CSD 3Microsoft SNA Server Version 3 with Service Pack 3 or later |
Windows XP | IBM Personal Communications for Windows Version 6.5 with APAR IC23490 |
Windows Server 2003 | APPC is not supported |
AIX | IBM Communications Server for AIX Version 6.1 or later |
HP-UX | SNAplus2 Link R6.11.00.00SNAplus2 API R.6.11.00.00 |
Linux | APPC is not supported |
Solaris | SNAP-IX for Solaris V7.02 |
where:
catalog appc node nodename
remote symbolic_destination_name
security security_type
- nodename is an arbitrary name. It must be unique in the client's node directory.
- symbolic_destination_name can be found in the CPI-C Side Information profile. You should have created this during the APPC software configuration.
- security_type is SAME, SECURITY, or PROGRAM.
6.3.4. Scenario 4: Remote Connection from a DB2 Client to a DB2 Host Server via a DB2 Connect Gateway
Imagine you have 1,000 clients who need to connect to a host database. If you set up the connections using DB2 Connect Personal Edition, you will need to purchase and install DB2 Connect Personal Edition on each of the 1,000 clients. This would be very costly. Wouldn't it be nice if you could only install DB2 Connect once on one machine, and use it as a gateway to service all connections from clients to the host database? Of course! For that scenario you need to use the DB2 Connect Enterprise Edition. Figure 6.15 illustrates this scenario.In this configuration, Machine 1 is the client, Machine 2 is referred to as the DB2 Connect gateway, and Machine 3 is the host database server.The DB2 Connect gateway is the only machine that needs to have DB2 Connect Enterprise Edition installed. Its task is to serve as a middleman between the clients and the host database server, since the clients do not have the ability to connect directly to the server. The gateway machine can serve hundreds of clients.When configuring this type of connection, you can break the three-tier connection into two parts.
- Part one is the gateway-to-host server connection. This is identical to what we discussed in Scenario 3. Follow the same steps as in section 6.3.3, Scenario 3: Remote Connection from a DB2 Client to a DB2 Host Server, to configure the gateway. Make sure you can connect from the gateway to the host database before proceeding to the next step.
- Part two is the client-to-gateway connection. From the client's perspective, the gateway machine is the database server. (The client does not know anything about the host server mpower.) Thus, when cofiguring this part of the connection, treat the gateway as the server, and follow the same steps described in section 6.3.2, Scenario 2: Remote Connection from a DB2 Client to a DB2 Server.
6.3.5. Binding Utilities
After a client establishes a connection to a database server, it should be able to access the data in the database. However, if you issue the import /export commands or try to run a CLI/ODBC application, you will get SQL0805N "Package not found" error. This is because the client has not bound these utilities to the database server.Utilities are database programs with embedded SQL; their packages must reside on the database server. Packages are version and FixPak level specific; therefore, a package created at the Version 8, FixPak 1 level cannot be used by a client running at Version 8, FixPak 2. If this client needs to use these utilities, it must create packages at its own DB2 level. (Refer to Chapter 7, Working with Database Objects, for a more detailed explanation of packages.)To create all of these packages at once, run the following commands from a DB2 Administration Client or the Application Development Client's CLP window:
If the database server is a host database, you must run one of the following commands on the DB2 Connect machine.
connect to database_alias user userid using password
bind @db2ubind.lst blocking all grant public
bind @db2cli.lst blocking all grant public
- If the host is DB2 for z/OS or OS/390:
bind @ddcsmvs.lst blocking all grant public - If the host is DB2 for iSeries:
You need to use the symbol @ when you specify a file that contains a list of bind files (with the .lst file extension), rather than a bind file (with the .bnd file extension) itself. The .lst files are in the install_directory \bnd directory on Windows and in the instance_home /sqllib/bnd directory on Linux/UNIX. Both contain a list of bind files the bind command will run against. A package is created for each of these bind files.
bind @ddcs400.lst blocking all grant public