The following must be done to allow an application requester to use TCP/IP.
To indicate that TCP/IP is to be used to establish a connection from the application requester, the communications directory, COMDIR, is used. If the COMDIR entry for the database that is the target of the SQL CONNECT statement has host and service entries defined, then TCP/IP will be used to establish the connection. If a DB2 Server for VM application requester wants to access a remote database using TCP/IP, an entry in the communications directory, COMDIR, must be set up.
The COMDIR must be set up to provide the host and service names the requester will use on the connection. A TCP/IP COMDIR entry will look like the following:
:nick.TCPVM1 :service.SQLTEST :host.TORVMLB6 :security.PGM :userid.USERID :password.PASSWORD :dbname.SQLTEST :nick.TCPVM2 :service.6100 :host.9.21.31.109 :security.PGM :userid.USERID :password.PASSWORD :dbname.SQLPROD
The tpn tag is replaced with the service tag and the luname tag is replaced with the host tag. The modename tag is not needed because it is an SNA network parameter. An IP address can be specified instead of a host name on the host tag and a port number can be specified on the service tag instead of a service name. This will bypass host name and service name lookup calls.
When the COMDIR search is done on the dbname, if the service and host tags are present, then TCP/IP will be used. If the tpn and luname tags are present, then SNA will be used. If both are present an error, SQLCODE = -841, SQLERRM = X'0015', will be issued. If the modename tag appears with the host and service tags, it will be ignored.
The security, userid and password tags will be used for both SNA and TCP/IP protocols. If TCP/IP communications is being used, the user cannot use APPCPASS directory statements for specifying the userid and password. APPCPASS is only used by SNA LU 6.2 communications.
The nick tag is still not used. The search of the COMDIR is based on the dbname tag and the first matching entry is used.
Since the COMDIR search is not performed until the user issues an SQL CONNECT statement, either implicitly or explicitly, any errors related to COMDIR setup problems must be reflected in an SQLCA returned to the application requester after the CONNECT statement. This will be reflected as SQLCODE = -841, A communications directory error has occurred. Reason Code=X'n'. The reason code will indicate the nature of the error.