0
votes

Win 7 64-bit SP 1

Getting error "ORA-12154: TNS:could not resolve the connect identifier specified" from .NET program.

I've installed Oracle 11.2 32-bit client on my machine.

Using Visual Studio 2010 I include the reference from C:\oracle\Ora112\odp.net\bin\4\Oracle.DataAccess.dll.

Using connection string value of: User Id=myid;Password=mypw;Data Source=DBNAME;pooling=false;Connection Timeout=45;

Running TNSPING DBNAME works. It says it's using C:\oracle\Ora112\network\ADMIN\sqlnet.ora. This file is set to use ldap instead of tnsnames.

Running sqlplus works. I am able to connect using myid/dbinstance

I can't think of any reason why ODP.NET is giving this error when all these other things are working. Any ideas?

1

1 Answers

1
votes

I've had to mess with different connection strings for different servers. Try a string modeled after the following:

DATA SOURCE=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=dbservername.company.com)(PORT=1542)))(CONNECT_DATA=(SID=your_sid_from_tnsnames.ora)(SERVER=DEDICATED)));USER ID=myid;Password=mypw