连接oracle时配置的Data source的名字到底是哪一个?
我用OracleClient.OracleConnection来连接oracle,其中的连接字符串中,Data source的到底是给它赋一个什么值,Tns名,服务名,还是数据库名?
------解决方案--------------------下面这个是oracle_10g_home
oracle安装目录\product\10.2.0\db_1\NETWORK\ADMIN\tnsnames.ora
//tnsnames.ora里面的内容如下:
# tnsnames.ora Network Configuration File: C:\oracle\product\10.1.0\Db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dong)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
第三行的orcl就是data source名
------解决方案--------------------sqlplus命令中的@后面的sid名