问题描述
我已经成功地使用Oracle数据库11g第2版(11.2.0.1.0)从净连接oracle的。 (在参考Oracle.DataAccess.dll版本是2.112.1.0)。
I've successfully used Oracle Database 11g Release 2 (11.2.0.1.0) to connect oracle from .Net. (in reference Oracle.DataAccess.dll version was 2.112.1.0).
但是,当我安装ODP.NET,当我试图连接到Oracle,它给了我一个错误:ORA-12154:TNS:无法解析指定的连接标识符。
But when I installed ODP.NET and when I am trying to connect to oracle, it gives me an error: "ORA-12154: TNS:could not resolve the connect identifier specified".
我该如何解决这个问题呢?
How can I solve this problem?
谢谢!
推荐答案
这通常发生在你的Oracle客户端是不是在您的计算机的路径。
This usually occurs when your oracle client is not in the PATH of your computer.
请确保 PATH
环境变量中包含< Oracle客户端路径>
和< Oracle客户端路径>。\ BIN
Make sure that the PATH
environment variable contains both <Oracle client path>
and <Oracle client path>\bin
.
此外,这可能发生,如果 SID
要连接到根本就不是在的tnsnames.ora 文件Oracle客户端安装路径下。如果我没有记错 - 它是根据
&LT; Oracle客户端路径&GT; \网络\ ADMIN \ tnsnames.ora中
Also, this can happen if the
SID
of the database you want to connect to is simply not defined in the tnsnames.ora
file under your oracle client installation path. If I recall correctly - it is under <Oracle client path>\network\admin\tnsnames.ora
编辑:注册表中应包含一个ORACLE条目下设置:
HKEY_LOCAL_MACHINE \ SOFTWARE \ ORACLE \
应该有 HOME0
处理字符串值命名为关键: ORACLE_HOME 和 ID 。我认为有需要,以及其他价值 - 但是这两个我敢肯定的。检查 ORACLE_HOME 正确地指向Oracle客户端的位置。
The registry should contain an ORACLE entry set under:
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\
There should be a key named HOME0
with string values: ORACLE_HOME and ID. I assume there are other values required as well - but those two I'm sure of. Check that ORACLE_HOME points correctly to the oracle client location.
这篇关于使用ODP.Net问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!