我已经在我的系统上设置了一个本地 Oracle 数据库,并且可以通过 SqlDeveloper 和 Sql*Plus (sqlplus system/mypassword@ORACLE) 进行连接,但是当我尝试在 Visual Studio 的部署选项中设置 ODP.Net 连接字符串时2010 CLR 项目然后我得到一个 ORA-12154:TNS:无法解析指定的连接标识符。
我执行的操作:Visual Studio 2010
文件
- 新项目
- 数据库
- 甲骨文
- Visual C# 甲骨文项目
建造
- 部署
- Oracle 部署向导启动,我创建一个具有以下细节的新连接:
- 数据源:Oracle 数据库 (ODP.NET)
- 数据源名称:ORACLE
- 用户名:系统
- 通行证:我的密码
- 测试连接
- ORA-12154: TNS: 无法解析指定的连接标识符
我的 tnsnames.ora 的内容:
# tnsnames.ora Network Configuration File: c:\app\oracle\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORACLE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORACLE)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
我的listener.ora的内容:
# listener.ora Network Configuration File: c:\app\oracle\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = c:\app\oracle\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:c:\app\oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost.domain.com)(PORT = 1521))
)
)
ADR_BASE_LISTENER = c:\app\oracle
sqlnet.ora的内容:
# sqlnet.ora Network Configuration File: c:\app\oracle\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)