Why does ODP.NET 11 xcopy deployment not work on a computer with Oracle DB 10 installed?

I have an application that uses the local version of ODAC 11 under the directory of the .exe file. The idea is that we want our application to use local ODAC 11, regardless of what the user has installed the machine on it.

Oracle.DataAccess.dll is located in the same directory as .exe.

It works fine when the Oracle client is not installed on the client computer, but I get an error message when I start on the computer with Oracle Database 10.2.0.something installed:

The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. [Stack Trace] The provider is not compatible with the version of Oracle client OracleException at Oracle.DataAccess.Client.OracleInit.Initialize() at Oracle.DataAccess.Client.OracleConnection..cctor() 

I assume this has something to do with the run-time binding policy, but Google's search for “Oracle / ODAC / ODP.NET run-time binding policy” didn’t bring anything useful.

Does anyone know how to solve a problem?

If this is not a problem, can someone tell me how to do what I want to do: make sure my application uses ODAC 11 no matter what?

+5
source share
4 answers

So, I understand, the problem was that while Oracle.DataAccess.dll was in the same directory as the application, it could not find its lower-level subordinates (oci, etc.), therefore, a compatibility error .

It turns out that if you want the application to work with deploying x64y ODAC 11 no matter what else the user could install on his computer, you need to do 2 things:

  • Set the PATH environment variable for the process. (I already did this.)
  • Set the ORACLE_HOME environment variable for the process. (I did not.)

     Environment.SetEnvironmentVariable("PATH", Environment.CurrentDirectory + "\\oracle\\11.1\\odac;" + Environment.CurrentDirectory + "\\oracle\\11.1\\odac\\bin;", EnvironmentVariableTarget.Process); Environment.SetEnvironmentVariable("ORACLE_HOME", Environment.CurrentDirectory + "\\oracle\\11.1\\odac", EnvironmentVariableTarget.Process); 

EDIT: It is also important to note that Oracle will throw this error not only for environmental issues, but also if one of the files is missing on the target machine. I got the same error on other machines, despite the environment settings, because I had Subversion to ignore directories called "bin", so the OraOps DLL was not copied to the client.

+4
source

An article entitled “Deploying ODP.NET with Oracle Instant Client”, found at http://alderprogs.blogspot.com/2009/04/deploying-odpnet-with-oracle-instant.html , gave me what it was for me The best explanation of how to deliver a shared xcopy deployment with your application. Only 5 Oracle DLLs are required for support.

However, the answers ObiWanKenobi and Josh Kodroff contain important additional information that is relevant to my experience.

Add to this: http://www.brothersincode.com/post/Oracle-ODPnet-xcopy-deployment-for-aspnet.aspx

+4
source

You want to force the ODP.NET drivers to use a copy of oci.dll, located in your local folder, and not already installed.

You can force it with

  • setting the PATH variable so that the system first finds your copy of the oci.dll file (as in Josh Kodroff’s answer)

or

  • you can use the ODP.NET configuration section in app.config (or web.config) to explicitly set the value to "DllPath".

For details, see http://ora-00001.blogspot.com/2010/01/odpnet-minimal-non-intrusive-install.html and http://database.in2p3.fr/doc/oracle/Oracle_Database_11_Release_1_(11.1)_Documentation /win.111/e10927/featConfig.htm

+2
source

If you are using the oracle 10.2.0.1 or 10.2.0.2 client, Oracle Note 215255.1 indicates that if you use patchset 10.2.0.3, it will fix the problem. Get the database patch 10.2.0.3 (852 MB) and fix the client house. Yes, this is a complete set of patches for the database server, but it also applies to the client.

0
source

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


All Articles