6

I'm developing an app in Visual Studio 2013 that connects to a Oracle Database. I have to use the "Unmanaged Driver". When I'm trying to create a new connection in a dataset, when I chose the "Managed Driver" all work fine: the tnsnames.ora is found. But when I select the "Unmanaged driver" all fails, it send me a message like " Failed to find the default tnsnames.ora file"

I already - Uninstalled all old Oracle Clients - Clean all environment variables - Reinstalled Oracle client, ODP tools for Visual Studio

Nothing seems to work. Any ideas ?

enter image description here

tapatio
  • 387
  • 1
  • 4
  • 9

7 Answers7

5

you should go to the folder containing the machine.config file. this file is found in %windir%\Microsoft.NET\Framework64\[version]\config\machine.config

make sure you have the following value.

<oracle.manageddataaccess.client>
    <version number="4.121.2.0">
      <settings>
        <setting name="TNS_ADMIN"value="E:\app\client\USERWINDOW\product\12.1.0\client_1\network\admin" />
      </settings>
    </version>
</oracle.manageddataaccess.client>

Also, refer to this post on Where Is Machine.Config?

Ori Nachum
  • 588
  • 3
  • 19
Angel Olguin
  • 59
  • 1
  • 5
2

You can ignore that message and simply use EZ Connect to connect (providing host, port, service_name).

Or you can find a valid TNSNAMES.ORA with your aliases in it, and copy it to: [ORACLE_HOME_WHERE_ODT_IS_INSTALLED]\NETWORK\ADMIN

Since Managed Driver can find TNSNAMES.ORA this means that TNS_ADMIN is set in the machine.config. When you connect using managed provider, the connection dialog will show you where it is finding the TNSNAMES.ORA and you can copy it over.

Christian Shay
  • 2,570
  • 14
  • 24
  • 1
    I had to use the EZ Connect as you said given that I couldn't fix the problem. I had a coworker that for him it work fine but we can't figure out why. – tapatio Apr 07 '15 at 18:52
  • I also found this to be the case, that this setting was unfortunately ignored, likely as another config was overriding this. – Ben O Aug 06 '19 at 05:59
0

The tnsnames.ora file should be in (installation dir)\network\admin. This is something your dba would provide.

The ORACLE_HOME environment variable is no longer necessary since that information is now found in the registry at HKLM\Software\Oracle.

However, if you have multiple oracle provider installs, it is nice to use the TNS_ADMIN environment variable to point all instances to a centralized folder where a shared tnsnames.ora is located.

b_levitt
  • 7,059
  • 2
  • 41
  • 56
0

Please ensure that below entries are present in machine.config so that default tnsnames.ora is correctly pointed to. In my case, entry was missing for unmanaged client and after adding it manually into machine.config, it worked correctly.

machine.config: ..

    <oracle.manageddataaccess.client>
      <version number="4.121.2.0">
       <settings>
        <setting name="TNS_ADMIN" 
        value="C:\app\client\username\product\12.1.0\client_1\network\admin" 
        />
       </settings>
      </version>
    </oracle.manageddataaccess.client>
    <oracle.unmanageddataaccess.client>
     <version number="4.121.2.0">
      <settings>
      <setting name="TNS_ADMIN" 
       value="C:\app\client\username\product\12.1.0\client_1\network\admin" 
      />
      </settings>
     </version>
    </oracle.unmanageddataaccess.client>

..

Shakil
  • 1
0

My solution was: going to the folder "...\product\12.2.0\client_1\odt\vs2017" and manually install the vs2017.exe , and after appeared it in visual studio 2017.

0

I've faced exactly the same issue today. Tried the steps above but didn't helped out.

Afterwards I figured out that on my machine ODAC was installed as well and Visual Studio tried to use the dll from the ODAC client.

After removal all worked like a charm.

Fabo137
  • 46
  • 4
0

You can try to create system variable (run Sysdm.cpl): name TNS_ADMIN and value e.g. "c:\app\client\Burn\product\12.2.0\client_1\network\admin\"