Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET / Oracle issue: TNS Could not resolve the connect identifier specified

I've got a local copy of an ASP.NET web application running in Visual Studio 2010. The code is an exact duplicate of the code running on my dev environment.

When I try to connect to my Oracle database through ASP.NET, it throws a "TNS could not resolve the connect identifier specified." The weird thing is this database is in my TNSNAMES.ORA file, and when I use TNSPING or Microsoft Data Link to connect, it works fine.

I tried tinkering with the permissions on my Oracle directory, but that didn't seem to help.

like image 296
Tim Avatar asked Aug 29 '12 12:08

Tim


1 Answers

Using TNS:

(For ASP.NET Core you need the TNS_ADMIN environment variable pointing to the directory where tnsnames.ora is located)

Data Source = TORCL; User Id = myUsername; Password = myPassword;

Not using TNS:

Data Source = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = MyHost) (PORT = MyPort))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = MyOracleSID));
User Id = myUsername; Password = myPassword;
like image 157
William Magno Avatar answered Sep 29 '22 02:09

William Magno