Start of change

DNS_LOOKUP table function

The DNS_LOOKUP table function queries a domain name server for IP address information about a hostname.

Authorization: If the HOSTALIASES environment variable is set, the caller must have:
  • Execute (*X) data authority to each directory in the path of the host aliases file specified by the HOSTALIASES environment variable, and
  • Read (*R) data authority to the host aliases file.
Read syntax diagramSkip visual syntax diagramDNS_LOOKUP( SEARCH_NAME => search-name ,DOMAIN_SERVER => domain-server)

The schema is QSYS2.

search-name
A character string containing the fully qualified domain name of the host to be resolved.
domain-server
A character string containing either a host name or an IP address for the domain name server, or an IP address string for it.
If this parameter is omitted, the IPv4 or IPv6 configured name servers from CHGTCPDMN are used.

The result of the function is a table containing rows with the format shown in the following table. All columns are nullable.

Table 1. DNS_LOOKUP table function
Column Name Data Type Description
ADDRESS_SPACE_TYPE CHAR(4) The IP address space type for IP_ADDRESS
IPV4
The address is specified using the IPv4 address space type.
IPV6
The address is specified using the IPv6 address space type.
IP_ADDRESS VARCHAR(45) The IP address. When ADDRESS_SPACE_TYPE is IPV4, the address is in IPv4 format. When ADDRESS_SPACE_TYPE is IPV6, the address is in IPv6 format.
AUTHORITATIVE VARCHAR(3) Indicates whether the DNS response containing the IP address was an authoritative answer.
NO
The DNS response was a non-authoritative answer.
YES
The DNS response was an authoritative answer.
AUTHENTICATED_DATA VARCHAR(3) Whether the data was authenticated.
NO
Data was not DNSSEC authenticated
YES
Data was DNSSEC authenticated.

Example

  • Determine the IP address for the ibm.com® hostname.
    SELECT * FROM TABLE(QSYS2.DNS_LOOKUP('ibm.com'));
    
End of change