Oracle ManagedDataAccess the way forward for connecting .NET applications to Oracle databases

If you have spent any amount of time working with Oracle databases as your back end, you know you have dealt with issues related to Oracle client installations. The client comes packaged in a large installer that installs a lot of other stuff along with the required drivers to connect with Oracle databases.

To be fair, the Oracle server component is in fact quite robust and comes with all the bells and whistles required for enterprise grade RDBMS software.

The problem is with the client itself. Should you install 32 bit or 64 bit version if you are on a 64 bit OS? How do I easily deploy to a clean slate machine without the large Oracle client already installed?

The good news is that all those issues are past if you are a .NET developer. You now have a 100% managed code driver in one package! The Oracle ManagedDataAccess library. It is completely native managed code unlike the Oracle DataAccess library which was just a .NET  wrapper to talk to the native binaries of the Oracle client.

What does this mean for the average developer? Well, no more Oracle client installation! No worries about 32 bit or 64 bit installations as it is targeted for AnyCPU. All you have to do is import the library as a nuget package(you are using nuget, arent you?) and you are DONE! You have everything you need in one small focused dll. It is packaged with your application as just another dll in the bin folder.

It was a long road to reach here. The journey was somewhat like below:

  1. ODBC drivers (remember the “good” ol’e days when you had to open Control Panel to set up ODBC connections? anyone? 😉 )
  2. Microsoft OLE DB provider for Oracle(the msdaora.dll one)
  3. Oracle Provider for OLE DB(based on the now legacy ADO technology but was an improvement over the Microsoft drivers)
  4. Oracle Data Access Components (ODAC/ODP.NET, which came initially with only a .NET wrapper to the native Oracle client dll’s)
  5. The ODP.NET from 12c onwards (this release provided the ManagedDataAccess library which is completely self contained and doesn’t require any Oracle client)

There is a small gotcha though, the completely managed drivers don’t support all the functionality of the previous Oracle .NET drivers which were a wrapper on the native Oracle client. But as per my experience, it should suffice for most the .NET developers making CRUD applications for businesses.

You can refer to Oracle Data Provider for .NET Developer’s Guide on the missing features in the managed driver.

If you don’t depend on the unsupported features, the new driver is a big leap ahead. You now have the following advantages:

  • No more installation of a large Oracle client
  • No worries about choosing 32/64 bit architecture
  • Easier deployment as it is completely self contained
  • Cleaner deployment as we don’t pollute the server with unneeded tools and utilities

You need to change your namespaces from Oracle.DataAccess.Client to Oracle.ManagedDataAccess.Client if you are migrating from the previous drivers and most of your code remains the same.

This is what Oracle has said about the new driver (emphasis mine):

ODAC 12c will be out on OTN and you can download that version. That will be our latest and greatest managed ODP.NET version

I believe any application using the old drivers should be migrated whenever possible and any new development should be done only using the latest driver as it is a big leap from the older versions. You cant beat the benefits and compatibility provided by a 100% managed, self contained driver. Moreover it’s less than 10Mb in size!

So go ahead, leave the Oracle client behind and forget the days when you had to decide between 32/64 bit installs 🙂

One thought on “Oracle ManagedDataAccess the way forward for connecting .NET applications to Oracle databases”

Leave a Reply

Your email address will not be published. Required fields are marked *