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.
not found 😦