EZCONNECT

From Oracle FAQ
Jump to: navigation, search

EZCONNECT is Oracle's easy connect naming method. EZCONNECT eliminates the need for service name lookups in tnsnames.ora files when connecting to an Oracle database across a TCP/IP network. In fact, no naming or directory system is required when using this method as it provides out-of-the-box connectivity. It extends the functionality of the host naming method by enabling clients to connect to a database with an optional port and service name in addition to the host name of the database.

Syntax[edit]

Syntax of the connect string:

CONNECT username/password@[//]host[:port][/service_name]

where:

  • //
Optional. Specify // for a URL.
  • host
Required. Specify the host name or IP address of the database server computer. The host name is domain-qualified if the local operating system configuration specifies a domain.
  • port
Optional. Specify the listening port. The default is 1521.
  • service_name
Optional. Specify the service name of the database. The default is the host of the database server computer. Note that this might not be the same value that you entered in the connect string for the host. For example, for the host emp, the service name might be emp.acme.com.
If the host does not match the database service name, then enter a valid service name value rather than accepting the default.

The connect identifier converts into the following connect descriptor:

(DESCRIPTION= 
  (ADDRESS=(PROTOCOL=tcp)(HOST=host)(PORT=port))
  (CONNECT_DATA=
    (SERVICE_NAME=service_name)))

For URL or JDBC connections, prefix the connect identifier with a double-slash (//):

CONNECT username/password@[//][host][:port][/service_name]

Examples[edit]

For example, the following connect strings connect the client to database service sales.us.acme.com with a listening endpoint of 1521 on database server sales-server.

CONNECT username/password@sales-server:1521/sales.us.acme.com
CONNECT username/password@//sales-server/sales.us.acme.com
CONNECT username/password@//sales-server.us.acme.com/sales.us.oracle.com

These connect strings convert into the following connect descriptor:

(DESCRIPTION= 
  (ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1521))
  (CONNECT_DATA=
    (SERVICE_NAME=sales.us.acme.com)))

If you performed a "typical" Oracle database server installation, the default service name for the instance will be ORCL. Use the following easy connect syntax to connect to that instance:

CONNECT username/password@host/ORCL

Using Easy Connect Naming on the Client[edit]

Clients can connect to a database server using easy connect naming if the following conditions are met:

  • Oracle Database 10g Net Services software installed on the client;
  • Oracle TCP/IP protocol support on both the client and database server; and
  • No features requiring a more advanced connect descriptor are required.

For large or complex environments where advanced features, such as connection pooling, external procedure calls, or Heterogeneous Services, which require additional connect information, are desired, easy connect naming is not suitable. In these cases, another naming method is recommended.

Easy connect naming is automatically configured at installation. Prior to using it, you may want to ensure that EZCONNECT is specified by the NAMES.DIRECTORY_PATH parameter in the sqlnet.ora file. This parameter specifies the order of naming methods Oracle Net can use to resolve connect identifiers to connect descriptors.

Verify if Easy Connect Naming is configured[edit]

To verify that the easy connect naming method is configured:

  • Start Oracle Net Manager.
  • In the navigator pane, expand Local > Profile.
  • From the list in the right pane, select Naming.
  • Click the Methods tab.
  • Check that EZCONNECT listed in the Selected Methods list.

Enable Easy Connect Naming[edit]

To enable Easy Connect Naming from Net Manager:

  • From the Available Methods list, select EZCONNECT, and then click the right-arrow button.
  • From the Selected Methods list, select EZCONNECT, and then use the Promote button to move the selection to the top of the list.
  • Choose File > Save Network Configuration.

The sqlnet.ora file will be updated with the NAMES.DIRECTORY_PATH parameter (listing ezconnect first):

NAMES.DIRECTORY_PATH=(ezconnect, tnsnames)

This can also be done by updating the sqlnet.ora file manually.