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.

4

3 回答 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.

于 2014-02-17T18:00:13.640 回答
0

Try this (server instead of data source)

Server=ORCL;User Id=c##shuvro;Password=admin;Persist Security Info=True;
于 2014-02-17T14:36:02.377 回答
0

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

于 2014-04-08T07:04:00.170 回答