programmernovice
programmernovice

Reputation: 3941

I can connect to Oracle programmatically but not from VS Server Explorer?

Using Oracle ODP this works

        OracleConnection con = new OracleConnection();
        con.ConnectionString = "Data Source=XE;User Id=hr;Password=hr;";

But when I use Visual Studio Server Explorer entering ODP and same parameters as above (copy and paste from advanced properties)

DATA SOURCE=XE;PERSIST SECURITY INFO=False;USER ID=HR

It says "TNS: could not resolve the connect identifier" Why ?

This is my TNSName.ora

XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = Whatever)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

Upvotes: 0

Views: 1453

Answers (2)

Jorge Luis
Jorge Luis

Reputation: 11

This actually solved my issue:

For Data source name, I used: host/service_name

Upvotes: 1

Matt
Matt

Reputation: 1242

Try using machinename/instancename to connect. For instance Whatever/XE for "DATA SOURCE".

EDIT: Also make sure you have defined a providerName.

providerName="System.Data.OracleClient"

I think you can also use Oracle.DataAccess.Client if you have the oracle client and libs installed.

Upvotes: 1

Related Questions