2

We are switching from the obsolete System.Data.OracleClient. I have switched all the references in the ASP.NET 2.0 code, however when I try to access the database server using ODP.NET calls I get ORA-12154: TNS:could not resolve the connect identifier specified. This works when I use System.Data.OracleClient on the same machine. Any suggestions about what is going wrong here?

3 Answers 3

2

You can avoid a dependency on Tnsnames.ora altogether, and go for the "independent" connection string in format:

Data Source =(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID))); User Id =myUsername; Password =myPassword;

BTW, you can look at connectionstrings.com/oracle for a quick, in-your-face list of supported connection string formats.

Sign up to request clarification or add additional context in comments.

1 Comment

I came across this very same issue. Omiting the TNSName did the trick but I'd prefer not to have to do a direct connect. It's strange that the TNSName works for everything accept the ODP.net connector.
1

It sounds like your client install doesn't have your TNS names setup correctly. If you just installed ODP.NET on this machine, you probably just installed another Oracle client, and have yet to configure it.

Comments

0

Copy the TNSNAMES.ORA from the /NETWORK/ADMIN directory in the Oracle home where the OracleClient was installed and copy over to the new /NETWORK/ADMIN directory where ODP.NET is installed.

http://www.oracle.com/technetwork/topics/dotnet/odt-faq-085407.html#ORA-12154:_TNS:could_not_resolve_the

Christian Shay

Oracle

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.