0

I'm using the NuGet Package Oracle.ManagedDataAccess. When calling OracleConnection.Open(); I get the error named in the title. My Connection string looks like Data Source=RAEDB;User ID=*****;Password=*****;. In the tnsnames.ora this Data Source is configured like

RAEDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = OraDB_IHDB)(PORT = 1521))
     (LOAD_BALANCE = yes)
    (CONNECT_DATA =      
      (SERVER = DEDICATED)
      (SERVICE_NAME = ihdb)
    )
  )

We don't use the sqlnet.ora, so the tnsnames.ora is used by default.

Weirdly this only happens in the NuGet Package version 12.2.1100, but not in 12.1.24160419. Might it be that version of the Package is faulty or is it some configuration I missed?

lenny
  • 734
  • 2
  • 15
  • 43
  • Have a look at this answer: https://stackoverflow.com/questions/28280883/determining-locatation-of-relevant-tnsnames-ora-file/28283924#28283924 Apparently the search pattern for `tnsnames.ora` file depends on release. – Wernfried Domscheit Sep 01 '17 at 09:25

1 Answers1

0

Where is your tnsnames.ora stored? According documentation (12c Release 4 (12.1.0.2.4)) the search path is:

  1. data source alias in the tnsnames.ora file at the location specified by TNS_ADMIN in the .NET config file. Locations can consist of either absolute or relative directory paths.
  2. data source alias in the tnsnames.ora file present in the same directory as the .exe.

However, based on some tests I made with ODP.NET ManagedDriver (4.121.2.0) it takes also %ORACLE_HOME%\network\admin and TNS_ADMIN Environment variable into account. Locks like the documentation is not 100% correct.

Note, unlike other drivers ODP.NET ManagedDriver does not read TNS_ADMIN value from your Registry!

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • I'm trying to use the `tnsnames.ora` in `%ORACLE_HOME%\network\admin`. So what you're saying is that the ODP.NET Managed Driver (4.122.2.0 (NuGet Package v12.2.1100)) does not use the `tnsnames.ora` in `%ORACLE_HOME%\network\admin` , but the Driver (4.121.2.0 (NuGet Package v12.1.24160419)) does? – lenny Sep 01 '17 at 09:31
  • I don't know. Documentation says it does not use `%ORACLE_HOME%\network\admin` – Wernfried Domscheit Sep 01 '17 at 09:44
  • Well it works for me now that I'm using the Driver version 4.121.2.0 – lenny Sep 01 '17 at 11:14