TNS connection descriptor format¶
A TNS connection descriptor is a string of text that describes the network route and database identification details required to establish a connection to an [[Oracle database]].^[600-developer__database__oracle__oracle-db-link.md] It provides a structured way to define connection parameters, such as the network protocol, host address, port, and the specific database service name.^[600-developer__database__oracle__oracle-db-link.md]
Structure¶
The descriptor follows a specific nested list format, typically enclosed in parentheses. The standard structure includes a top-level DESCRIPTION block containing an ADDRESS_LIST (or ADDRESS) section and a CONNECT_DATA section.^[600-developer__database__oracle__oracle-db-link.md]
ADDRESS¶
The ADDRESS section defines the network location of the database server. It typically includes:
* PROTOCOL: Usually TCP.^[600-developer__database__oracle__oracle-db-link.md]
* HOST: The IP address or hostname of the database server (e.g., 10.140.0.1).^[600-developer__database__oracle__oracle-db-link.md]
* PORT: The listening port of the database listener, typically 1521.^[600-developer__database__oracle__oracle-db-link.md]
CONNECT_DATA¶
The CONNECT_DATA section identifies the specific database service or instance to connect to.^[600-developer__database__oracle__oracle-db-link.md] The most common parameter used here is:
* SERVICE_NAME: The name of the database service (e.g., myPay).^[600-developer__database__oracle__oracle-db-link.md]
Usage Example¶
This format is frequently used when creating database links (DB links) in Oracle. For example, when executing a CREATE DATABASE LINK statement, the connection string is passed directly to the USING clause.^[600-developer__database__oracle__oracle-db-link.md]
Below is an example of a complete connection descriptor string:
(DESCRIPTION=
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.140.0.1)(PORT = 1521))
)
(CONNECT_DATA = (SERVICE_NAME = myPay))
)
Sources¶
^[600-developer__database__oracle__oracle-db-link.md]