Visual Studio ODP Unmanaged Driver - Could not find default tnsnames.ora file (12c)

I am developing an application in Visual Studio 2013 that connects to an Oracle database. I have to use "Unmanaged driver". When I try to create a new connection in the dataset, when I select "Managed driver", everything works fine: tnsnames.ora is found. But when I select "Unmanaged driver", everything fails, it sends me a message like "Could not find the default tnsnames.ora file"

I already - Removed all old Oracle clients - Clear all environment variables - Reinstalled Oracle client, ODP tools for Visual Studio

Nothing seems to work. Any ideas?

enter image description here

+6
source share
5 answers

you must go to the folder containing the machine.config file. this file is located 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 in Where is Machine.Config located?

+4
source

You can ignore this message and just 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 the managed driver can find TNSNAMES.ORA, this means that TNS_ADMIN is set to machine.config. When you connect to a managed provider, the connection dialog will show you where it finds TNSNAMES.ORA, and you can copy it.

+1
source

The tnsnames.ora file must be located in the (dir) \ network \ admin directory. This is what dba will provide you.

The environment variable ORACLE_HOME is no longer needed because this information is now in the registry in HKLM \ Software \ Oracle.

However, if you have several oracle provider providers, it is useful to use the TNS_ADMIN environment variable to point all instances to the centralized folder where the tnsnames.ora shared is located.

0
source

Please make sure the machine.config file has the value below so that tnsnames.ora is specified by default. In my case, the entry was missing for the unmanaged client and after manually adding it to 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> 

..

0
source

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

0
source

Source: https://habr.com/ru/post/984189/


All Articles