Oracle 11g 客户端是否需要 ODP.NET?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1160218/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is ODP.NET required for Oracle 11g Client?
提问by Jeff Martin
I may be asking the wrong question here, I'm willing to change it if so.
我可能在这里问错了问题,如果是这样,我愿意改变它。
I have a project that is using the Microsoft.NET Oracle provider (our plan is to change to ODP but we haven't done so yet).
我有一个使用 Microsoft.NET Oracle 提供程序的项目(我们的计划是更改为 ODP,但我们还没有这样做)。
I am trying to get this project to build on a windows 2008 (x64) build server. It builds just fine but our unit tests fail when they hit stuff on the Oracle database.
我试图让这个项目在 Windows 2008 (x64) 构建服务器上构建。它构建得很好,但我们的单元测试在遇到 Oracle 数据库上的内容时失败。
I had initially installed the 32bit oracle 9i client which is what we currently use on our winxp dev boxes and the previous 2003 build server. But now this gets a message like: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.
我最初安装了 32 位 oracle 9i 客户端,这是我们目前在我们的 winxp 开发箱和之前的 2003 构建服务器上使用的。但现在这会得到一条消息,如:尝试加载 Oracle 客户端库抛出了 BadImageFormatException。在安装了 32 位 Oracle 客户端组件的情况下以 64 位模式运行时,会出现此问题。
We tried compiling to the x86 platform but that didn't change the error message.
我们尝试编译到 x86 平台,但这并没有改变错误消息。
I now have the 11g 64 bit client installed but I am getting a message saying System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.
我现在安装了 11g 64 位客户端,但收到一条消息,提示 System.Data.OracleClient 需要 Oracle 客户端软件版本 8.1.7 或更高版本。
So what Oracle install should I be using?
那么我应该使用什么 Oracle 安装?
Edit:
编辑:
I was able to get this to work. Turned out it was the testing causing the problem, by forcing NUnit to run in 32bit mode: http://geekswithblogs.net/Lance/archive/2006/12/28/102191.aspxI was able to get the tests to work using the old 32 bit driver. This would be a crappy answer to the question so I am not using it but will gladly award the correct answer to anyone putting in some good info on transitioning to Oracle 64bit drivers.
我能够让这个工作。原来是测试导致了问题,通过强制 NUnit 在 32 位模式下运行:http: //geekswithblogs.net/Lance/archive/2006/12/28/102191.aspx我能够使用测试工作旧的 32 位驱动程序。这将是对这个问题的蹩脚答案,所以我没有使用它,但很乐意将正确答案授予任何提供有关过渡到 Oracle 64 位驱动程序的好信息的人。
回答by Mac
When it comes to Oracle, I like to use Oracle Instant Client:
说到 Oracle,我喜欢使用Oracle Instant Client:
- You don't have to install anything on the target machines (including dev boxes !).
- You can make sure that your application will run with the specific client you picked.
- You could even easily have multiple applications work with different client versions on the same computer.
- As a downside, it adds a significant weight to your application (~19Mb minimum).
- 您不必在目标机器上安装任何东西(包括开发箱!)。
- 您可以确保您的应用程序将与您选择的特定客户端一起运行。
- 您甚至可以轻松地让多个应用程序在同一台计算机上使用不同的客户端版本。
- 不利的一面是,它会显着增加您的应用程序的权重(最低约 19Mb)。
Check What is the minimum client footprint required to connect C# to an Oracle database?for more information. To know how to set up a Visual Studio project that will work on x86 as well as x64 machines, check my blog post Oracle Instant Client in Visual Studio.
检查将 C# 连接到 Oracle 数据库所需的最小客户端占用空间是多少?想要查询更多的信息。要了解如何设置可在 x86 和 x64 计算机上运行的 Visual Studio 项目,请查看我的博客文章Oracle Instant Client in Visual Studio。
回答by flindeberg
I'm adding a new answer since as of this fall (2012) the ODP Managed Code Beta is available. See this linkfor more information. It is for us highly stable and we are using it in production, mainly because of these reasons:
自今年秋季(2012 年)起,ODP 托管代码 Beta 版可用,因此我正在添加一个新答案。有关更多信息,请参阅此链接。它对我们来说非常稳定,我们在生产中使用它,主要是因为以下原因:
- No installation (except for entity framework where a simple registration is needed)
- It is smaller than the unmanaged version, the footprint is approx 6 MB.
- It is NOT "bit sensitive", ie Any CPU will finally work with ODP :)
- More intuitive mapping C# types <-> Oracle types (and it solved some problems with EF and model generation from database)
- Supports EZCONNECT (all versions of the unmanaged ODP did not), ie no more tnsnames.ora hassles.
- 无需安装(需要简单注册的实体框架除外)
- 它比非托管版本小,占用空间约为 6 MB。
- 它不是“位敏感”,即任何 CPU 最终都可以使用 ODP :)
- 更直观的映射 C# 类型 <-> Oracle 类型(并且解决了 EF 和从数据库生成模型的一些问题)
- 支持 EZCONNECT(所有版本的非托管 ODP 都没有),即没有更多的 tnsnames.ora 麻烦。
But for transitioning to 64 bit, download the managed ODP driver and change the Oracle.DataAccess
reference to Oracle.ManagedDataAccess
and recompile :)
但是要转换到 64 位,请下载托管 ODP 驱动程序并更改Oracle.DataAccess
引用Oracle.ManagedDataAccess
并重新编译:)
回答by Chris Gill
I have had an issue which could relate to what you are seeing.
我遇到了一个问题,可能与您所看到的有关。
I initially had the just the Oracle 10g client installed on my machine and the .Net Oracle.DataAccess component version number was 10.2.0.100 - this was for .Net runtime v1.0.3705
我最初只在我的机器上安装了 Oracle 10g 客户端,并且 .Net Oracle.DataAccess 组件版本号是 10.2.0.100 - 这是用于 .Net runtime v1.0.3705
I installed ODP.Net and the Oracle.DataAccess component version is now v2.102.2.20 and runs on .Net runtime v2.0.50727 - I cant find the reference as to why Oracle did this - it was something to do with bringing version numbers in line with the runtime version
我安装了 ODP.Net 并且 Oracle.DataAccess 组件版本现在是 v2.102.2.20 并在 .Net 运行时 v2.0.50727 上运行 - 我找不到关于 Oracle 为什么这样做的参考 - 这与引入版本号有关与运行时版本一致
It took me a day to work this out. We dont use the 11g client yet and I havent used the 8i client for ages so I dont know what the version numbers would be for those clients, but I'd check it if I were you what.
我花了一天的时间来解决这个问题。我们还没有使用 11g 客户端,而且我很久没有使用 8i 客户端了,所以我不知道这些客户端的版本号是多少,但如果我是你的话,我会检查一下。
In short, Oracle back-tracked the component version numbers which could be making your 11g component appear out-of-date as opposed to Oracle 8i components
简而言之,Oracle 回溯了组件版本号,这可能会使您的 11g 组件与 Oracle 8i 组件相比显得过时
回答by FerranB
I think the message "System.Data.OracleClient requires Oracle client software version 8.1.7 or greater"it's similar to "Oracle client not installed, installed but not found or installed but it's needed 8.1.7 or greater".
我认为消息“System.Data.OracleClient 需要 Oracle 客户端软件版本 8.1.7 或更高版本”类似于“Oracle 客户端未安装、安装但未找到或安装但需要 8.1.7 或更高版本”。
Check on regedit if the values are right under the key:
检查 regedit 的值是否在键下:
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraOdac11g_home1
Where OraOdac11g_home1
depends on the Oracle Home name for your installation.
位置OraOdac11g_home1
取决于您的安装的 Oracle 主目录名称。
Also, try to connect through Visual Studio to see if its possible.
此外,尝试通过 Visual Studio 进行连接以查看是否可行。
回答by Govind
This can be a cause of multiple oracle homes in the environment. Remove the older version oracle home in your build system. try generating the build again with the single home. There are some issues with 9i version ODP.NET and 10G/11G connectivity
这可能是环境中出现多个 oracle home 的原因。在您的构建系统中删除旧版本的 oracle home。尝试使用单个房屋再次生成构建。9i 版本 ODP.NET 和 10G/11G 连接存在一些问题
回答by rohancragg
I have found many times that the error "requires Oracle client software version 8.1.7 or greater" is a notoriously misleading error. From distant memory I seem to remember that this usually indicates a file IO permissions problem. I think it may be that the ASP.NET worker process (or whichever identity an application is running under) requires some sort of read or write permission to a folder in the oracle client folder hierarchy...
我多次发现错误“需要 Oracle 客户端软件版本 8.1.7 或更高版本”是一个众所周知的误导性错误。从遥远的记忆中,我似乎记得这通常表示文件 IO 权限问题。我认为可能是 ASP.NET 工作进程(或应用程序在其下运行的任何身份)需要对 oracle 客户端文件夹层次结构中的文件夹的某种读取或写入权限......