Users initiate a connection request to a database service by providing a connect string.
A connect string includes:
A connect identifier can be the connect descriptor itself or a name that resolves to a connect descriptor.
One of the most common connect identifiers is a net service name, a simple name for a service. The following examples demonstrate one connect string that uses a complete connect descriptor as the connect identifier and another connect string that uses net service name sales as the connect identifier.
tool username@connect_identifier
Enter password: password
Example with SQLPlus on a shell
sqlplus username/password@connect_identifier
In SqlPlus with the CONNECT command:
CONNECT username/password@connect_identifier
username/password@connect_identifier
Applications written in 3GL, such as oci and pre-compilers, are used by middle-tier and database application developers for direct database access from a client program.
exec sql connect :username identified by :password
In the preceding connection request, :username and :password are 3GL variables that can be set within the program either statically or by prompting the user.
CONNECT scott/tiger@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server1)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=sales.us.acme.com)))
CONNECT scott/tiger@sales
When net service name is used, connection processing takes place by first mapping sales to the connect descriptor. This mapped information is stored in one or more repositories of information that are accessed with naming methods.
The process for establishing a client session with the aid of a naming method is as follows: