ODP.NET是否需要安装Oracle客户端
我必须从 .NET 代码连接 Oracle 11g DB。为此,我安装了 ODP.NET,但在阅读了一些论坛帖子后,我意识到我也需要安装 Oracle 客户端。
这是真的吗?我看到 Oracle 客户端的大小为 ca。 2GB!!!我真的需要安装这么大的客户端才能连接 Oracle 数据库吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
Oracle 的 Alex Keh 在 2013 年 8 月说道:
====
Nuget 管理的 ODP.NET:
那么问题到底是什么?
基本上到目前为止,ODP.NET 是一个与 Oracle 客户端 .dll 文件通信的 .NET 层,这个小事实具有很多含义:
机器或部署大文件
那是什么?
托管驱动程序基本上是一个 .dll 文件,具有 ODP.NET 的 .Net 本机实现.
这意味着不需要 Oracle 客户端,现在本机代码位于幕后。 XCopy 安装可以轻松完成。
主要优点:
并顺利申请。轻松管理多个版本
同一台机器
bin 目录。
那么有什么问题吗?
上找到更多信息
Oracle.DataAccess.Client 到 Oracle.ManagedDataAccess.Client
始终执行非常高效,但另一方面 100% 得到管理
代码有其性能优势。
请注意,本机代码 ODP.NET 仍然非常可用。除了本机版本之外,还提供了托管版本(至少目前如此)。
参考文献: http://oracleatdotnet.blogspot.com .es/2013/07/odpnet-management-driver-beta-2.html
ODP.NET托管驱动程序和非托管驱动程序之间的差异
http://docs.oracle.com/html/E41125_02/intro004.htm
Oracle Data Provider for .NET 的功能
http://docs.oracle.com/database/121/ODPNT/features .htm#ODPNT0007
Alex Keh from Oracle in aug 2013 says:
====
Nuget managed ODP.NET:
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:
machine or deploy large files
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:
and application smoothly. Easy to manage multiple versions on the
same machine
bin directory.
So what's the catch?
can find out more on the documentation
Oracle.DataAccess.Client to Oracle.ManagedDataAccess.Client
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
您也可以使用 NuGet 来托管 ODP.NET https://www.nuget.org/ packages/odp.net.management/
观看有关使用 ODP.NET 托管驱动程序的快速入门视频! (复制自 http://www.oracle.com/technetwork/topics/ dotnet/whatsnew/index.html)
http://www.youtube.com/watch?feature=player_embedded&v=I1q50HnUh_w
更新:
用于官方 Oracle ODP.NET 的 NuGet,托管驱动程序
https://www.nuget.org/packages/Oracle.ManagedDataAccess/
或包经理控制台
you can get managed ODP.NET using NuGet too https://www.nuget.org/packages/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
ODP.NET 确实需要本机 OCI DLL (~130 MB)。
获取所有必要文件的最简单方法可能是从 oracle.com 下载“带有 XCopy 部署的 Oracle 数据访问组件”。
作为参考,ODP.NET 在运行时使用以下 DLL:
顺便说一句,无论您使用的是 32 位还是 64 位本机 Oracle DLL,您都需要小心 - 您必须将它们与“位数”相匹配“您的托管代码。如果您正在为“任何 CPU”构建,因此位数不是固定的,这尤其棘手。
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:
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.
最新的 ODAC 版本附带 Oracle 即时客户端,因此您无需安装完整的客户端。
(32 位版本)
(64 位版本)
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)
我留下这个答案是因为随着 ODP.net 托管驱动程序的发布,旧的答案现在有点过时了。
ODP.net 托管驱动程序现已发布。
64 位 Oracle 数据访问组件 (ODAC)
<块引用>
重要:实体框架设计时功能需要下载 32 位 Oracle Developer Tools for Visual Studio。下面支持实体框架部署的下载不包含设计时工具,仅包含运行时支持。
带有 Oracle 开发工具的 32 位 Oracle 数据访问组件 (ODAC)对于 Visual Studio
目前可用的版本 ODAC 12cR2 向后兼容 Oracle 10gR2 或更高版本。请参阅ODAC 12cR2 的系统要求部分安装说明。 ODAC 12cR2 需要/支持版本 4 到 4.5.1 的 .Net 框架。
以前版本的 ODAC 12cR1 也向后兼容 Oracle 10gR2 或更高版本,根据其 安装说明。
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.
64-bit Oracle Data Access Components (ODAC)
32-bit Oracle Data Access Components (ODAC) with Oracle Developer Tools for Visual Studio
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.
使用现在可用的托管的oracle-client。托管 AnyCPU 6MB dll。
Use the managed oracle-client which is available now. A managaged AnyCPU 6MB dll.
它对我有用(没有 Oracle 客户端的 PC):
编辑:
虽然这个解决方案运行良好;
今天,我认为最好的方法是使用 Oracle Managed Data Access 驱动程序。当我们需要避免桌面和服务器环境之间出现问题时,如果其中一个环境不使用相同的(32 位或 64 位)架构,这是否更好;
感谢 Iron Automation:
链接:http://www.iron-automation.com/2018/02/connecting-to-oracle-database-without-installing-oracle-client/
下面的解决方案将适用于 11g 和 12c 数据库。
请按照以下步骤操作:
第 1 步
我们需要 Oracle 提供的一组 dll 来在我们的项目中使用。因此,在第一步中,请下载适合您的 Windows 版本的 Oracle 数据访问组件 (ODAC)。截至本文发布之日,有效的下载 URL 为: http://www.oracle.com/technetwork/topics/dotnet/downloads/odacdeploy-4242173.html
注意:ODAC 32 位版本适用于 32 位和 64 位。我在使用 64 位版本时遇到了几个问题。所以我建议直接下载32位版本。
打开下载的 zip 文件并将下面的 dll 放在一起。我列出了 dll 以及您可以在其中找到它们的文件夹。稍后我们会将它们复制到调试文件夹中。
步骤 2
使用 Visual Studio 创建控制台应用程序,并将步骤 1 中列出的 dll 复制到与项目可执行文件相同的文件夹(即 Debug 文件夹)中。通过浏览到刚刚将此 dll 复制到的调试文件夹来添加对“Oracle.DataAccess.dll”的引用。
它对我有用(安装了 Oracle 客户端的 PC):
下载驱动程序 XCOPY 版本:
https://www.oracle.com/database/technologies /dotnet-odacdeploy-downloads.html
32 位 ODAC 12.2.0.1.0
ODAC122010Xcopy_32bit.zip
只需在项目中添加对 Oracle.DataAccess.dll 的引用
引用:
浏览到 odp.net4 文件夹(支持批量插入)
将此文件复制到 ouptut bin 文件夹:
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.
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:
Browse to odp.net4 folder (With bulk insert support)
Copy this files to ouptut bin folder: