0

It's pretty confusing task to connect to oracle database. There are many steps to follow and I guess I followed almost everything and solved too many errors on the way. Now I'm stuck at this stage with the error

Oracle.DataAccess.Client.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified

my tnsnames.ora file

ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = orcl)
  )
)

my ORACLE_HOME path specified in environment variable

F:\app\Shuvro\product\12.1.0\dbhome_1\BIN;

my connectionstring in web.config

Data Source=ORCL;User Id=c##shuvro;Password=admin;Persist Security Info=True;

tnsping ORCL returned OK.

I'm using Visual Studio 2013 and Oracle 12c Enterprise Database. I installed ODP.NET and ODAC. Now what I'm missing here? Any help much appreciated.

8
  • All seems ok, try to connect via sqlplus. You have only one oracle client installed? Commented Feb 17, 2014 at 13:09
  • This could help ora-12154.ora-code.com Commented Feb 17, 2014 at 13:36
  • so you trying to connect to Oracle Installed on same machine? Commented Feb 17, 2014 at 13:40
  • @bdn02 yah only one oracle client Commented Feb 17, 2014 at 16:19
  • @OuSs I went through that too many times before posting question here, no luck. thanks for suggesting anyway Commented Feb 17, 2014 at 16:20

3 Answers 3

1

modify tnsnames file to include name of your machine or IP address instead of localhost you can't rely for it to be translated correctly.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks a lot man! I just changed the host name from localhost to 127.0.0.1 and that solved it.
0

Try this (server instead of data source)

Server=ORCL;User Id=c##shuvro;Password=admin;Persist Security Info=True;

1 Comment

this throws ArgumentException with message 'Server' is an invalid connection string attribute.
0

You should download and install Oracle Developer Tools for Visual Studio to connect to oracle database

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.