Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
273 views
in Technique[技术] by (71.8m points)

c# - Problem on using ODP.Net

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).

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?

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This usually occurs when your oracle client is not in the PATH of your computer.

Make sure that the PATH environment variable contains both <Oracle client path> and <Oracle client path>in.

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> etworkadminnsnames.ora

Edit: The registry should contain an ORACLE entry set under: HKEY_LOCAL_MACHINESOFTWAREORACLE
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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...