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

I had been happily using my application locally for some time, but it was time to deploy it for user testing, and we know how things go wrong when that happened. After publishing my MVC application, I starting getting this error:

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

Research suggested a connection string problem. In my web.config, I had a connection string similar to this:

 <add name="ConnString" connectionString="DATA SOURCE=ScottDb;PASSWORD=blah;USER ID=scott" />

What I needed to do was configure it to look like an entry in the tnsnames.ora file, like so:

 <add name="ConnString" connectionString="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=Some-Host)(PORT=6000))(CONNECT_DATA=(SERVICE_NAME=scottprod.scott.com)));User Id=scott;Password=blah;" />

If your not sure where your tnsnames.ora file is located, you can try using the tnsping command to locate it. When I ran the command “tnsping ScottDb”, the file location and connection string was returned, so that may help you.

Advertisements
  1. Leave a comment

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: