How to install ODP.NET 2.111 and ODP.NET 4.112 in the same machine side-by-side while both point to the same database server

痞子三分冷 提交于 2019-11-29 12:59:53

The short answer:

Note: I did try to install the new ODP.NET over the previous client and was able to connect to database using the following connection string...

This indicates that your new install does not have a tnsnames.ora and sqlnet.ora in /Network/Admin. If you're OK with the old client using the new ODP.net install, than you can either copy them from the old installation or you can specify a global location for all instances with the TNS_ADMIN environment variable, ie TNS_ADMIN=C:\MyOracleFilesDir

The long answer:

When you installed the new client it most likely also installed publisher policy files into the GAC that redirect references to the old Oracle.DataAccess.dll to the new version during the assembly resolution process. Oracle.DataAccess then locates the client via a parameter (DllPath) in the registry. You can override this location by setting the dllPath in your .config file:

<configuration>
  <oracle.dataaccess.client>
    <add key="DllPath"            value="C:\yourotherpath"/>
  </oracle.dataaccess.client>
</configuration>

This is generally what I do, but as I understand this more, I realize that I'm forcing a newer dll against an older client. If your goal is to leave the old client untouched, a better option may be to delete the publisher policies from the GAC (I don't think they are even installed with the full ODAC install, only ODP.net):

If you need to reinstall them they are generally found at oraclepath\odp.net\PublisherPolicy.

Another, and maybe a better long term option, is to configure the old clients to ignore the publisher policy: http://msdn.microsoft.com/en-us/library/cf9025zt%28v=vs.80%29.aspx

Finally, I'm pretty sure the .net components for the 2.0 vs. 4.0 frameworks are separate install options during the ODP.net installation. I think you might be able to avoid this issue simply by not installing the 2.0 components. On that note you could do a similar work around by developing your new project against the 64 bit odp.net instead. Like v2.0 and v4.0, 32 bit and 64 bit also do not have any awareness of each other.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!