JG Vimalan's Blog

It is all about coding!

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

I got this error in my development system when I am trying to connect a oracle 10g database via my WCF serivce developed in .NET 4.0 framework.

The wcf service was running in IIS 7.5 and using the DefautAppPool. My suspect was the oracle client installed in my system. I could see that, I had different instances of Oracle 11g client in my system. So, I thaught of identifying the active one.

Inorder to find that, I opened the command prompt and typed tnsping <oracle database name>. Now, I was able to see the active oracle instance in my system as shown below,

In my case, it is client_2. Apart from this, I had client_1 and client_4 installed in my system.

As a next step, I verified the registry and found that, different instances of oracle exists as shown below,

Now, I modified the ‘Oracle Home’ for all instances to point to the correct location (in my case, it is client_2). See below,

I then recycled the application pool.

Tried to connect the oracle database via code and it worked!


April 26, 2012 - Posted by | C#.NET, Oracle


  1. hi i am using oracle 10g express edition.. i cant connect oracle with my asp.net web application.. pls help me to solve this issue

    Comment by Kannan | April 29, 2012 | Reply

    • Hi Kannan,

      Please provide me the exception details and the Oracle client version.

      Vimalan JG

      Comment by JG Vimalan | April 30, 2012 | Reply

  2. Hi ,

    I am trying to connect to a destination oracle db and i have made the correct tnsnames entries in my local server. and I am able to tnsping the destination db.
    But when i am trying to post a message via an integration tool , it throws and exeption:

    ORA-12154: TNS:could not resolve the connect identifier specified.

    The same tnsnames entries are working fine in my testing environment. But while working on a production server , it is throwing the above error. My test server and prod server share almost same configurations.

    Could you please suggest any other areas to look out for.

    Monil Jain

    Comment by Monil Jain | September 28, 2012 | Reply

    • Please make sure that,
      a) The production server has correct tnsnames entries.
      b) The firewall rules (if any) for connecting production server with production oracle database are properly set.
      I suspect point (b) could be the cause. Let me know how it goes.

      Best regards,
      Vimalan JG

      Comment by Vimalan JG | September 28, 2012 | Reply

  3. oracel is a PITA, it should just work like MSSQL

    Comment by shane | June 3, 2016 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: