Home | Previous Page | Next Page   Configuration > Client/Server Communications > The sqlhosts Information >

Alternatives for TCP/IP Connections

The following sections describe some ways to bypass port and IP address lookups for TCP/IP connections.

IP Addresses for TCP/IP Connections

For TCP/IP connections (both TLI and sockets), you can use the actual Internet IP address in the hostname field instead of the host name or alias found in the hosts file. The IP address is always composed of four sets of one to three integers, separated by periods. Table 7 shows sample IP addresses and host from a hosts file.

Table 7. A Sample hosts File
Internet IP Address Host Name Host Alias(es)
555.12.12.12 smoke
98.765.43.21 odyssey
12.34.56.789 knight sales

Using the IP address for knight from Table 7, the following two sqlhosts entries are equivalent:

sales   ontlitcp   12.34.56.789   sales_ol   
sales   ontlitcp   knight         sales_ol   

Using an IP address might speed up connection time in some circumstances. However, because computers are usually known by their host name, using IP addresses in the host name field makes it less convenient to identify the computer with which an entry is associated.

You can find the IP address in the net address field of the hosts file, or you can use the UNIX arp or ypmatch command.

Wildcard Addressing for TCP/IP Connections

You can use wildcard addressing in the host name field when both of the following conditions are met:

If the preceding conditions are met, you can use an asterisk (*) as a wildcard in the host name field that the database server uses. When you enter a wildcard in the host name field, the database server can accept connections at any valid IP address on its host computer.

Each IP address is associated with a unique host name. When a computer has multiple network-interface cards (NICs), as in Figure 13, the hosts file must have an entry for each interface card. For example, the hosts file for the texas computer might include these entries.

NIC Internet IP Address Host Name
Card 1 123.45.67.81 texas1
Card 2 123.45.67.82 texas2

You can use the wildcard (*) alone or as a prefix for a host name or IP address, as shown in Table 8.

If the client application and database server share connectivity information (the sqlhosts file), you can specify both the wildcard and a host name or IP address in the host name field (for example, *texas1 or *123.45.67.81). The client application ignores the wildcard and uses the host name (or IP address) to make the connection, and the database server uses the wildcard to accept a connection from any IP address.

The wildcard format allows the listen thread of the database server to wait for a client connection using the same service port number on each of the valid network-interface cards. However, waiting for connections at multiple IP addresses might require slightly more CPU time than waiting for connections with a specific host name or IP address.

Figure 13 shows a database server on a computer (texas) that has two network-interface cards. The two client sites use different network cards to communicate with the database server.

Figure 13. Using Multiple Network-Interface Cards
begin figure description - This figure is described in the surrounding text. - end figure description

The connectivity information for the texas_srvr database server can be any of the entries in Table 8.

Table 8. Possible Connectivity Entries for the texas_srvr Database Server
database server name connection type host name service name
texas_srvr ontlitcp *texas1 pd1_on
texas_srvr ontlitcp *123.45.67.81 pd1_on
texas_srvr ontlitcp *texas2 pd1_on
texas_srvr ontlitcp *123.45.67.82 pd1_on
texas_srvr ontlitcp * pd1_on

Important:
You can include only one of these entries.

If the connectivity information corresponds to any of the preceding lines, the texas_srvr database server can accept client connections from either of the network cards. The database server finds the wildcard in the host name field and ignores the explicit host name.

Tip:
For clarity and ease of maintenance, it is recommended that you include a host name when you use the wildcard in the host name field (that is, use *host instead of simply *).

The connectivity information used by a client application must contain an explicit host name or IP address. The client applications on iowa can use any of the following host names: texas1, *texas1, 123.45.67.81, or *123.45.67.81. If there is an wildcard (*) in the host name field, the client application ignores it.

The client application on kansas can use any of the following host names: texas2, *texas2, 123.45.67.82, or *123.45.67.82.

Port Numbers for TCP/IP Connections

For the TCP/IP network protocol, you can use the actual TCP listen port number in the service name field. The TCP port number is in the port# field of the services file.

Using the port number for the sales database server from the services file in Figure 12, an entry in sqlhosts could also be written as in the following example.

servername nettype hostname servicename
sales ontlitcp knight 1536

Using the actual port number might save time when you make a connection in some circumstances. However, as with the IP address in the host name field, using the actual port number might make administration of the connectivity information less convenient.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]