You are on page 1of 6

Chapter 1.

DB2 Connect access to an AS/400 system via TCP/IP

Since OS/400 V4R2, it is possible to connect to an AS/400 system from DB2 Connect on a Windows machine using TCP/IP. Previous OS/400 versions require an SNA connection. The following example employs OS/400 V4R5 and the DB2 UDB for Windows NT Version 7.1.

1.1 On the AS/400 system

The following process lists the necessary steps to be performed on the AS/400 system: 1. Verify that the TCP/IP stack is working correctly. To do this, obtain the IP address of the AS/400 system or hostname, and ping the AS/400 system from the DB2 Connect machine. To get the IP address, go to the Configure TCP/IP menu. Enter CFGTCP, and choose Work with TCP/IP interface. The IP address should be displayed as shown in Figure 1.

Work with TCP/IP Interfaces System: Type options, press Enter. 1=Add 2=Change 4=Remove Internet Opt Address Subnet Mask 5=Display 9=Start 10=End AS23

Line Line Description Type TRNLINE *TRLAN

Bottom F3=Exit F12=Cancel F5=Refresh F17=Top F6=Print list F18=Bottom F11=Display interface status

Figure 1. Work with TCP/IP Interfaces

2. To get the hostname, go to the Configure TCP/IP menu, and choose Work with TCP/IP host table entries. You should find the hostname that has been assigned to the IP address. 3. You need a relational database (RDB) name for the AS/400 system. If it has already been created, you can display it by using the DSPRDBDIRE command. The RDB with a location of *LOCAL is the one you need, as shown in Figure 2. If it has not been created, use the ADDRDBDIRE command to add the RDB entry. For example, the following command would add an RDB entry named DALLASDB:

Copyright IBM Corp. 2000

Display Relational Database Directory Entries Position to . . . . . . Type options, press Enter. 5=Display details 6=Print details Relational Option Database AS23 AS24 Remote Location *LOCAL

Text DB entry for local AS23 RBD Entry for AS24

Bottom F3=Exit F5=Refresh F6=Print list (C) COPYRIGHT IBM CORP. 1980, 2000. F12=Cancel

Figure 2. Display Relational Database Directory Entries

4. You must create a collection called NULLID. The reason for this is that the utilities shipped with DB2 Connect and DB2 UDB store their packages in the NULLID collection. Since it does not exist by default in the AS/400 system, you must create it using the following command:

5. Products that support DRDA automatically perform any necessary code page conversions at the receiving system. For this to happen, both systems need a translation table from their code page to the partner code page. The default Coded Character Set Identifier (CCSID) on the AS/400 system is 65535. Since DB2 Connect does not have a translation table for this code page, you need to change the individual user profiles to contain a page. You need to change the individual user profiles to contain a CCSID that can be converted properly by DB2 Connect. For US English, this is 037. For other languages, see DB2 Connect Personal Edition Quick Beginning , GC09-2967. The following command changes the CCSID for an individual user profile to 037:

6. Verify that you are using the default port 446 for DRDA service. To do this, go to the Configure TCP/IP menu (CFGTCP), select Configure Related Tables, and then select Work with service table entries . Verify that the DRDA service is set for port 446, as shown in Figure 3.

DB2 Connect Access to AS/400

Work with Service Table Entries System: Type options, press Enter. 1=Add 4=Remove 5=Display Opt Service drda echo echo exec finger finger ftp-control ftp-control ftp-data ftp-data gopher Port Protocol 446 7 7 512 79 79 21 21 20 20 70 udp tcp udp tcp tcp udp tcp udp tcp udp tcp More... Parameters for options 1 and 4 or command ===> F3=Exit F4=Prompt F5=Refresh F6=Print list F17=Top F18=Bottom
Figure 3. Work with Service Table Entries




7. The Distributed Data Management (DDM) job must be started for DRDA to work. If you want the DDM job to be automatically started whenever TCP/IP is started, you can change the attributes of the DDM job using the CHGDDMTCPA command and set the Autostart server parameter to *YES. 8. If you choose not to autostart the server, issue the following command to start the DDM server job:

9. Make sure you have user IDs defined on the AS/400 system for users that will be connecting.

1.2 On the workstation

The following steps are required on DB2 UDB: 1. Launch Client Configuration Assistant ( db2cca from command prompt). 2. Click the Add button to add a new data source. 3. On the Source tab, choose Manual configuration, and click Next . 4. On the Protocol tab, choose TCP/IP for protocol, and select the item The database physical residence on a host or AS/400. Then, select the option Connect directly to the server, as shown in Figure 4 on page 6. Click Next .

Chapter 1. DB2 Connect access to an AS/400 system via TCP/IP

Figure 4. Protocol tab of the workstation configuration

5. On the TCP/IP tab, fill in the host name of the AS/400 system. The port number should be 446. Click Next. 6. On the Database tab, fill in the Relational Database name, and click Next . 7. If you plan to use the ODBC applications, select Register this database for ODBC as a system data source on the ODBC tab. 8. Click Finish. 9. Click Test Connection to verify that the connection works. You are prompted for an AS/400 user ID and password, as shown in Figure 5.

Figure 5. Prompt for AS/400 user ID and password

DB2 Connect Access to AS/400

10.Enter your user ID and password, and then click OK. If the connection test passed, a successful message box appears, as shown in Figure 6.

Figure 6. Message box for successful connection

Chapter 1. DB2 Connect access to an AS/400 system via TCP/IP

DB2 Connect Access to AS/400