Sqlnet Ezconnect Feature

你是否被经常编写和复制tnsnames.ora的项目所困扰?
EZCONNECT就是解决这一问题的功能。

使用这一功能,我们可以访问Oracle数据库而不需要tnsname或者directory服务,只需要使用如下格式:

Hostname/ORACLE_SID

例子:

sqlplus system/1.0.861.291|drowssap#1.0.861.291|drowssap/orcl

开启这一功能,我们只需要按如下方式添加EZCONNECT到sqlnet.ora中:

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

当然,EZCONNCET功能还有更加复杂的形式。参见官方文档:


http://docs.oracle.com/cd/B19306_01/win.102/b14307/featConnecting.htm#sthref115

Using Easy Connect Naming Method
The easy connect naming method enables clients to connect to a database without any configuration.
Prior to using the easy connect naming method, make sure that EZCONNECT is specified by the > NAMES.DIRECTORY_PATH parameter in the sqlnet.ora file as follows:

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

With this enabled, ODP.NET allows applications to specify the "Data Source" attribute in the form of:

//host:[port]/[service_name]

Using the same example, some valid connection strings follow:

"user id=scott;password=tiger;data source=//sales-server:1521/sales.us.acme.com"
"user id=scott;password=tiger;data source=//sales-server/sales.us.acme.com" 
"user id=scott;password=tiger;data source=sales-server/sales.us.acme.com"

If the port number is not specified, 1521 is used by default.

See Also:
Oracle Net Services Administrator's Guide for details and requirements in the section Using Easy Connect Naming Method
----

Reference:

http://docs.oracle.com/cd/B19306_01/win.102/b14307/featConnecting.htm#sthref115

See Also:
SQLNET EZCONNECT Feature
SQLNET EZCONNECT Feature