ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA ODP.NET

ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

After installing the ODT.NET 11g in my F Drive, I found F:appchanmmproduct11.1.0client_1NetworkAdmin does not consist of any file but a directory named Sample. So I did not do anything after installation and straightaway run Visual Studio 2008. When I was creating a new Data Connections I hit the error: ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA.

The fact is, the files in the Sample directory are meant to be edited and put it in the ..NetworkAdmin directory. The sqlnet.ora and tnsnames.ora are the files that need to be edited.

Surprisingly my sqlnet.ora needs to remark a line to let the error gone. The example as below:

SQLNET.AUTHENTICATION_SERVICES= (NTS)

# NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

After I have edited the files sqlnet.ora and tnsnames.ora in Sample directory and copied them from F:appchanmmproduct11.1.0client_1NetworkAdminSample directory to F:appchanmmproduct11.1.0client_1NetworkAdmin then remark one line of sqlnet.ora. Finally I am able to connect from Visual Studio 2008 to Oracle Database 11g.

If you hit the same error then there is no harm to have a try on what I have done. Have a good experience with ODP.NET 11g and Oracle Database 11g.

Note: Thanks to Mark A. William help me to solve the error on ODP.NET forum.

About chanmingman

Since March 2011 Microsoft Live Spaces migrated to Wordpress (http://www.pcworld.com/article/206455/Microsoft_Live_Spaces_Moves_to_WordPress_An_FAQ.html) till now, I have is over 1 million viewers. This blog is about more than 50% telling you how to resolve error messages, especial for Microsoft products. The blog also has a lot of guidance teaching you how to get stated certain Microsoft technologies. The blog also uses as a help to keep my memory. The blog is never meant to give people consulting services or silver bullet solutions. It is a contribution to the community. Thanks for your support over the years. Ming Man is Microsoft MVP since year 2006. He is a software development manager for a multinational company. With 25 years of experience in the IT field, he has developed system using Clipper, COBOL, VB5, VB6, VB.NET, Java and C #. He has been using Visual Studio (.NET) since the Beta back in year 2000. He and the team have developed many projects using .NET platform such as SCM, and HR based applications. He is familiar with the N-Tier design of business application and is also an expert with database experience in MS SQL, Oracle and AS 400.
This entry was posted in .Net. Bookmark the permalink.

1 Response to ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA ODP.NET

  1. andres says:

    not found 😦

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.