DEV Community

Cover image for Redirecting legacy .NET apps to a new Oracle DataAccess
Marcos Junior
Marcos Junior

Posted on

1

Redirecting legacy .NET apps to a new Oracle DataAccess

Published on October 13, 2018

I wrote this guide to help you dealing with a development or production environment that needs to run multiple legacy .net applications that are highly coupled with an specific version of Oracle DataAccess. With this guide you don't have to change any line of code, reference, or configuration of each project.

This guide will also help you to keep your system clean, running only one lighweight version of Oracle Client.

This guide aims to help you on how to configure a clean and lightweight Oracle Client with .NET Framework. This guide is intended for legacy applications that are bound with classic Oracle.DataAccess. It is recommended to move on to Oracle.ManagedDataAccess.

Download

32 bits version
http://www.oracle.com/technetwork/database/windows/downloads/utilsoft-087491.html
ODAC 11.2 Release 6 (11.2.0.4.0) [Released January 14, 2014]

64 bits version
http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html
64-bit ODAC 11.2 Release 6 (11.2.0.4.0) Xcopy for Windows x64 [Released January 14, 2014]

Installing

First, make sure you don't have any previous installations, remove all tracks of oracle, look into program files, windows registry, environment variables and file system. Having multiple versions of oracle client might cause incompatibilities. Backup your TNS before removing previous versions.

Then, extract the xcopy package you downloaded from oracle, then open CMD as admin, go to the extracted folder and execute:

install odp.net4 c:\oracle\client11g_x64 client11g_x64 true
install odp.net2 c:\oracle\client11g_x64 client11g_x64 true
install oramts c:\oracle\client11g_x64 client11g_x64 true

in most of the cases we don't need asp.net package.

After installing your oracle client, create your tnsnames.ora in C:\oracle\client11g_x64\network\admin

If you need the 32bit client, use the same commands above replacing 64 by 32.

Configuring framework redirects

This should make sure that your app will work with this version even if it is strongly coupled with an older version of DataAccess.

Framework 4

Open both files:

  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config

And add:

  <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
          <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
          <bindingRedirect oldVersion="0.000.0.0-4.112.4.0" newVersion="4.112.4.0"/>
          </dependentAssembly>
          <qualifyAssembly partialName="Oracle.DataAccess" fullName="Oracle.DataAccess,version=4.112.4.0,publicKeyToken=89b483f429c47342,culture=neutral" />
      </assemblyBinding>
  </runtime>

Framework 2

Open these files:

  • C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config
  • C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.config

And add:

 <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
       <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
       <bindingRedirect oldVersion="0.000.0.0-2.112.4.0" newVersion="2.112.4.0"/>
       </dependentAssembly>
       <qualifyAssembly partialName="Oracle.DataAccess" fullName="Oracle.DataAccess,version=2.112.4.0,publicKeyToken=89b483f429c47342,culture=neutral" />
    </assemblyBinding>
</runtime>

Please fell free to give feed back and suggest improvements.

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay