Friday, October 7, 2011

ORA-12154: TNS:could not resolve the connect identifier specified in Visual Studio

Hi guys,

If you are trying to connect to an Oracle Database, through Server Explorer in Visual Studio, you have to ensure that:

1. You have installed the Oracle Data Provider (downloadable from the Oracle Website)
2. Have created the tnsnames.ora file, holding information about the databases ( This file should be created most often in the Network\Admin folder under the Oracle Provider. In my case: C:\app\user\product\11.2.0\client_1\Network\Admin

After having these prerequisites, I still couldn't connect to the Oracle Database. The Visual Studio wizard told me: "ORA-12154: TNS:could not resolve the connect identifier specified". What resolved this issue for me was to add the Environment Variable with name "TNS_ADMIN" and value the Path to the directory containing the "tnsnames.ora" file.
Something like:
Then just restart Visual Studio and you're free to go.

Hope this helps someone out there :)