llasarov
llasarov

Reputation: 2111

Does ODP.NET require Oracle Client installation

I have to connect Oracle 11g DB from .NET code. For that purpose I installed ODP.NET bur after reading some forum posts I recognized that I need Oracle Client installation too.

Is that true? I see that the Oracle Client has a size of ca. 2GB!!! Do I really need to install such a huge client only to be able to connect Oracle DBs?

Upvotes: 38

Views: 61104

Answers (7)

nandox
nandox

Reputation: 101

It worked for me (PC without Oracle Client):

Edited:

Although this solution worked well; Today, I think the best approach is to use the Oracle Managed Data Access drivers. Is it better when we need to avoid issues between desktop and server environments when one of them is not using the same (32-bit or 64-bits) architecture;

Thanks to Iron Automation:

Link: http://www.iron-automation.com/2018/02/connecting-to-oracle-database-without-installing-oracle-client/

The solution below will apply both to 11g and 12c databases.

Follow the steps:

  • Step 1

    We will need a set of dlls provided by Oracle to use in our project. So at this first step, download Oracle Data Access Components (ODAC) for your version of Windows. As of the posting date of this article, the valid download URL is: http://www.oracle.com/technetwork/topics/dotnet/downloads/odacdeploy-4242173.html

    Note: ODAC 32 bit version works both for 32bit and 64bit. And I had several problems when using 64bit version. So I can suggests directly downloading the 32bit version.

    Open the downloaded zip file and get the dlls below together. I listed the dlls with the folder where you will find them. We will later copy them into our debug folder.

    \instantclient_12_2\ 
        oci.dll  
        orannzsbb12.dll  
        oraocci12.dll  
        oraocci12d.dll  
        oraociei12.dll  
        oraons.dll  

    \oramts\bin\  
        oramts.dll  
        oramts12.dll  
        oramtsus.dll  

    \odp.net4\odp.net\bin\4\  
        Oracle.DataAccess.dll  

    \odp.net4\bin\  
        OraOps12.dll  
  • Step 2

    Use Visual Studio to create a console application and copy the dlls listed in Step 1 into the same folder as your project executable, the Debug folder. Add a reference to “Oracle.DataAccess.dll” by browsing to your Debug folder where you have just copied this dll into.

It worked for me (PC with Oracle Client Installed):

    ------------------------------- ------------------- ----------- ----------------- --------------------------- ----------------------- 
    Name                            Date modify         Size        Version           Folder                      Type                  
    ------------------------------- ------------------- ----------- ----------------- --------------------------- ----------------------- 
    Oracle.DataAccess.dll           24/05/2017 16:46    2.100 KB    4.122.1.0         
  • Browse to odp.net4 folder (With bulk insert support)

  • Copy this files to ouptut bin folder:

    ------------------------------- ------------------- ----------- ----------------- --------------------------- ----------------------- 
    Name                            Date modify         Size        Version           Folder                      Type                  
    ------------------------------- ------------------- ----------- ----------------- --------------------------- ----------------------- 
    oci.dll                         13/02/2017 23:31    1.270 KB    12.2.0.0          InstantClient_12_2          Extensão de aplicativo    
    ociw32.dll                      13/02/2017 22:20      346 KB    11.1.0.1          InstantClient_12_2          Extensão de aplicativo    
    orannzsbb12.dll                 05/12/2016 18:38    4.329 KB    12.2.0.1          InstantClient_12_2          Extensão de aplicativo    
    oraocci12.dll                   13/02/2017 21:29    1.006 KB    12.2.0.1          InstantClient_12_2          Extensão de aplicativo    
    OraOps12.dll                    24/05/2017 16:45      433 KB    2.122.1.0         InstantClient_12_2          Extensão de aplicativo    

  • OBS: In my case it´s not necessary:
    ------------------------------- ------------------- ----------- ----------------- --------------------------- ----------------------- 
    Name                            Date modify         Size        Version           Folder                      Type                  
    ------------------------------- ------------------- ----------- ----------------- --------------------------- ----------------------- 
    Oracle.ManagedDataAccess.dll    24/05/2017 16:07    4.763 KB    4.122.1.0         

Upvotes: 1

Riju
Riju

Reputation: 576

you can get managed ODP.NET using NuGet too https://www.nuget.org/packages/odp.net.managed/

PM> Install-Package odp.net.managed 

Watch the quick start video on using ODP.NET Managed Driver! (copied from http://www.oracle.com/technetwork/topics/dotnet/whatsnew/index.html)

http://www.youtube.com/watch?feature=player_embedded&v=I1q50HnUh_w


Update:

NuGet for Official Oracle ODP.NET, Managed Driver https://www.nuget.org/packages/Oracle.ManagedDataAccess/

Or Package Manager Console

PM> Install-Package Oracle.ManagedDataAccess

Upvotes: 12

Kiquenet
Kiquenet

Reputation: 15036

Alex Keh from Oracle in aug 2013 says:

Managed ODP.NET is released. It is currently part of the Oracle DB 12c client. To use managed ODP.NET, you have to download and install the DB client. From there, you can extract just the managed ODP.NET assembly and setup files. These files are less than 10 MB and can be deployed to any target machines.

Currently, we are packaging a stand alone managed ODP.NET release and ODAC 12 release that will be much smaller. This will be released on OTN shortly.

If you can wait a couple of days, ODAC 12c will be out on OTN and you can download that version. That will be our latest and greatest managed ODP.NET version

====

We do not plan to put managed ODP.NET on NuGet. We believe that the managed ODP.NET download with ODAC will provide the same benefits of NuGet in terms of assembly isolation and download size.

There's a thread discussing whether Oracle should provide managed ODP.NET NuGet support. Once you use ODAC 12c, I would like to know your thoughts on whether NuGet support is still necessary. https://forums.oracle.com/thread/2559445

Nuget managed ODP.NET:

PM> Install-Package Oracle.ManagedDataAccess

So what is the problem anyway?
Basically up until now, ODP.NET was a .NET layer that talks to the Oracle client .dll files, a small fact that had many implications:

  • Large installation footprint (several hundreds of Mb)
  • Tough deployment to remote machines - needs to install ODP.NET on client machine or deploy large files
  • Challenging when working with several versions, 32bit/64bit os and applications

So what is it?

The managed driver is basically a single .dll file with a .Net native implementation of ODP.NET.
That means no Oracle Client is needed, and now native code is behind the scenes. XCopy installation can be done easily.

Major benefits:

  • Small footprint
  • Compiled as any cpu so it can work on 32bit/64bit OS and application smoothly. Easy to manage multiple versions on the same machine
  • Can be deployed as a simple reference in the application bin directory.

So what's the catch?

  • Not all features are supported (although most of them are... ) you can find out more on the documentation
  • Namespace is changed from Oracle.DataAccess.Client to Oracle.ManagedDataAccess.Client
  • Performance differences are still not clear. (The old) Native code always perform very efficiently, but on the other hand 100% managed code has it's performance benefits.

Please note that the Native-Code ODP.NET is still very much available. The managed version (at least for now) comes in addition to the native one.

References: http://oracleatdotnet.blogspot.com.es/2013/07/odpnet-managed-driver-beta-2.html

Differences between the ODP.NET Managed Driver and Unmanaged Driver http://docs.oracle.com/html/E41125_02/intro004.htm

Features of Oracle Data Provider for .NET http://docs.oracle.com/database/121/ODPNT/features.htm#ODPNT0007

Upvotes: 38

sampathsris
sampathsris

Reputation: 22290

I am leaving this answer because with the release ODP.net managed driver, old answers are a bit obsolete now.

ODP.net managed driver is released now.

Currently available version ODAC 12cR2 is backwards compatible with Oracle 10gR2 or later. See the System Requirements section of ODAC 12cR2 Installation Instructions. ODAC 12cR2 requires/supports .Net frameworks from version 4 to 4.5.1.

Previous version ODAC 12cR1 too is backwards compatible with Oracle 10gR2 or later according to it's installation instructions.

Upvotes: 5

Grastveit
Grastveit

Reputation: 16160

Use the managed oracle-client which is available now. A managaged AnyCPU 6MB dll.

Upvotes: 2

Branko Dimitrijevic
Branko Dimitrijevic

Reputation: 52157

The ODP.NET does require native OCI DLLs (~130 MB).

Probably the easiest way to get all the necessary files is to download the "Oracle Data Access Components with XCopy deployment" from oracle.com.

For your reference, the following DLLs are used by ODP.NET at run-time:

oci.dll
Oracle.DataAccess.dll (the managed ODP.NET assembly itself)
orannzsbb11.dll
oraociei11.dll
OraOps11w.dll

BTW, you'll need to be careful whether you are using 32-bit or 64-bit native Oracle DLLs - you must match them with the "bitness" of your managed code. This is especially tricky if you are building for "Any CPU" so the bitness is not fixed.

Upvotes: 11

vc 74
vc 74

Reputation: 38179

The latest ODAC releases ship with Oracle instant client so you don't need to install the full client.

(32 bit release)

(64 bit release)

Upvotes: 8

Related Questions