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 t
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):
Download Driver XCOPY Version:
https://www.oracle.com/database/technologies/dotnet-odacdeploy-downloads.html
32-bit ODAC 12.2.0.1.0
ODAC122010Xcopy_32bit.zip
Just add reference to Oracle.DataAccess.dll in the project references:
------------------------------- ------------------- ----------- ----------------- --------------------------- -----------------------
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
------------------------------- ------------------- ----------- ----------------- --------------------------- -----------------------
Name Date modify Size Version Folder Type
------------------------------- ------------------- ----------- ----------------- --------------------------- -----------------------
Oracle.ManagedDataAccess.dll 24/05/2017 16:07 4.763 KB 4.122.1.0