Shuvro
Shuvro

Reputation: 1499

connecting to oracle database in asp.net

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.

Upvotes: 0

Views: 3811

Answers (3)

Ali
Ali

Reputation: 684

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

Upvotes: 0

user275683
user275683

Reputation:

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.

Upvotes: 1

christof13
christof13

Reputation: 329

Try this (server instead of data source)

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

Upvotes: 0

Related Questions