WIN7安装完ODAC之后,会在目录“C:\app\client\xushunyi\product\12.1.0\client_1\Network\Admin”下生成一个tnsnames.ora文件,里面用于配置Oracle数据库实例信息,一般可以参照Sample目录下的tnsname.ora文件对其进行配置。实例内容如下:
# Every line that begins with # is a comment line
#
# Create Oracle net service names, or aliases, for each database server
# you need to connect to.
#
# TNSNames.ora sample entry
#
# alias =
# (DESCRIPTION =
# (ADDRESS = (PROTOCOL = TCP)(HOST = myserver.mycompany.com)(PORT = 1521))
# (CONNECT_DATA =
# (SERVER = DEDICATED)
# (SERVICE_NAME = orcl)
# )
# )
#
# You can modify the entry below for your own database.
# <data source alias> = Name to use in the connection string Data Source
# <hostname or IP> = name or IP of the database server machine
# <port> = database server machine port to use
# <database service name> = name of the database service on the server
<data source alias> =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <hostname or IP>)(PORT = <port>))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = <database service name>)
)
)