DB2 .NET 数据提供程序的 SQL1159 初始化错误,原因代码 7,令牌 9.5.0.DEF.2,SOFTWARE\IBM\DB2\InstalledCopies
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29370/
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
SQL1159 Initialization error with DB2 .NET Data Provider, reason code 7, tokens 9.5.0.DEF.2, SOFTWARE\IBM\DB2\InstalledCopies
提问by jsight
I am trying to get the DB2 data provider from a 32-bit .Net application to connect to DB2 running as a 32-bit application on Vista 64 (is that confusing enough yet)? Unfortunately, I am getting the following error:
我正在尝试从 32 位 .Net 应用程序获取 DB2 数据提供程序,以连接到在 Vista 64 上作为 32 位应用程序运行的 DB2(这是否足够令人困惑)?不幸的是,我收到以下错误:
SQL1159 Initialization error with DB2 .NET Data Provider, reason code 7, tokens 9.5.0.DEF.2, SOFTWARE\IBM\DB2\InstalledCopies
DB2 .NET 数据提供程序的 SQL1159 初始化错误,原因代码 7,令牌 9.5.0.DEF.2,SOFTWARE\IBM\DB2\InstalledCopies
There are several IBM forum postsmentioning it, but little useful guidance. Has anyone experienced this before? Or do you have better ideas for fixing it?
有几个IBM 论坛帖子提到了它,但几乎没有有用的指导。有谁之前经历过这个吗?或者你有更好的想法来修复它?
采纳答案by Mark Brackett
Are you required to have it run as x86? I had similar issues with web apps under Visual Studio's dev web server (which is x86), but switching over to IIS (x64) worked for me. Since I was deploying to IIS x64, I called it a day at that point.
你需要让它作为 x86 运行吗?我在 Visual Studio 的开发 Web 服务器(x86)下的 Web 应用程序遇到了类似的问题,但切换到 IIS (x64) 对我有用。由于我正在部署到 IIS x64,因此我当时称它为一天。
I tried tracing with Filemon and Regmon, but didn't get any denied or missing keys errors. If I were to look again, I'd check HKLM\Software\WOW6432Node, guessing that the installer writes to the x64 HKLM\Software node, but not the x86 one.
我尝试使用 Filemon 和 Regmon 进行跟踪,但没有收到任何拒绝或丢失密钥的错误。如果我再看一遍,我会检查 HKLM\Software\WOW6432Node,猜测安装程序写入的是 x64 HKLM\Software 节点,而不是 x86 节点。
回答by Booji Boy
I vaguely remember having a similar sounding problem with the DB2 for as/400 oledb driver when trying to set up a linked server from sql 2005 to the as/400. It was a permissions issue and I eventually found that only sql server accounts (not windows) could use the linked server because (i think) then the driver was loading using the credentials of the sql instead of impersonated ones. If it works when "run as" admin then it gotta be permissions.
我依稀记得在尝试设置从 sql 2005 到 as/400 的链接服务器时,DB2 for as/400 oledb 驱动程序也有类似的问题。这是一个权限问题,我最终发现只有 sql server 帐户(不是 windows)可以使用链接服务器,因为(我认为)然后驱动程序正在使用 sql 的凭据而不是模拟的凭据加载。如果它在“以管理员身份运行”时工作,那么它必须是权限。
回答by Michael Sharek
I assume you have seen the writeup of SQL1159in the DB2 Reference Guide?
我假设您已经在DB2 参考指南中看到了SQL1159的文章?
Unfortunately for you, the reason codes stop at 6 and don't continue to 7. It does say:
对您来说不幸的是,原因代码在 6 处停止并且不会继续到 7。它确实说:
User response: There was a problem with your DB2 installation. If this is the first time DB2 was installed on this computer, review the install logs for any possible errors and run a repair of DB2 from the Add/Remove Programs control panel applet. The default location of the installation logs is the My Documents/DB2LOG folder of the user that performed the installation. If this does not resolve the issue please contact IBM Support and provide the reason code associated with this message along with any installation logs.
用户响应:您的 DB2 安装有问题。如果这是第一次在此计算机上安装 DB2,请查看安装日志以查找任何可能的错误,并从“添加/删除程序”控制面板小程序运行 DB2 修复程序。安装日志的默认位置是执行安装的用户的 My Documents/DB2LOG 文件夹。如果这不能解决问题,请联系 IBM 支持并提供与此消息相关的原因代码以及任何安装日志。
So I guess try to reinstall it and if the problem continues you'll have to contact IBM.
所以我想尝试重新安装它,如果问题仍然存在,您将不得不联系 IBM。
Sorry, I know that's not much help.
抱歉,我知道这没有多大帮助。
回答by jsight
I uninstalled the previous 32bit version, reinstalled as 64bit, and now I get a completely different error. Its mentioned as requiring FP2 to fix, but since I'm using Express-C, I can't install the fixpack (IBM doesn't provide fixpacks for free DB2 products). Anyway, thanks for the help. At least I can come closer to connecting now. :)
我卸载了以前的 32 位版本,重新安装为 64 位,现在出现完全不同的错误。它提到需要 FP2 来修复,但由于我使用的是 Express-C,我无法安装修复包(IBM 不为免费的 DB2 产品提供修复包)。无论如何,感谢您的帮助。至少我现在可以更接近连接了。:)
回答by icelava
I encountered this error on a Windows 2003 x86 server as well. Originally my problem was
我也在 Windows 2003 x86 服务器上遇到了这个错误。原来我的问题是
Unable to find the requested .net framework data provider. it may not be installed.
无法找到请求的 .net 框架数据提供程序。它可能没有安装。
which led to comments that c:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config was missing the necessary entries for the DbProviderFactories section. And indeed, there were no IBM DB2 entries there. When I manually added in an entry, I then encountered this error of yours, suggesting that there is morethan just editing machine.config.
这导致评论 c:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config 缺少 DbProviderFactories 部分的必要条目。事实上,那里没有 IBM DB2 条目。当我在一个条目手动添加,我再遇到你这个错误,这表明有更多的不仅仅是编辑的machine.config。
Evenutally I uninstalled the IBM DB2 driver set, reboot the system, reinstalled it, and got it initializing connections properly.
最后我卸载了 IBM DB2 驱动程序集,重新启动系统,重新安装它,并让它正确初始化连接。
回答by icelava
Just as a quick note...
就像一个快速说明...
@Micheal: the link you had for SQL1159 is to the Version 9.1 docs
The Version 9.5 documentation goes up to reason code 9
http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.messages.sql.doc/doc/msql01159n.html
@Micheal:SQL1159 的链接是 9.1
版文档 9.5 版文档上升到原因代码 9
http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2 .luw.messages.sql.doc/doc/msql01159n.html
Unfortunately, I think there is a 10th reason code that is undocumented there but it is in a developerWorks topic
http://www.ibm.com/developerworks/wikis/display/DB2/DB2+and+.NET+FAQ#DB2and.NETFAQ-WhatisSQL1159InitializationError%3F
不幸的是,我认为有第 10 个原因代码没有记录在那里,但它在 developerWorks 主题
http://www.ibm.com/developerworks/wikis/display/DB2/DB2+and+.NET+FAQ#DB2and.NETFAQ -WhatisSQL1159InitializationError%3F
回答by Farshid
I had the same problem with DB2 .net provider.
我在 DB2 .net 提供程序上遇到了同样的问题。
If you have windows 64 bit then download and install
IBM Data Server Runtime Client (Windows AMD 64) Version 9.5
from
_https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?lang=en_US&source=swg-idsrc11&S_TACT=appddnet&S_CMP=ibm_im
如果您有 Windows 64 位,
则从 _https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?lang=en_US&source=swg下载并安装 IBM Data Server Runtime Client (Windows AMD 64) 9.5 版-idsrc11&S_TACT=appddnet&S_CMP=ibm_im
If you run your program you would get the following exception
如果你运行你的程序,你会得到以下异常
Unhandled Exception: System.Overflow Exception: Arithmetic operation resulted in an overflow. at IBM.Data.DB2.DB2ConnPool.Open(DB2Connection connection, StringszConnectionStringIn, DB2ConnSettings& ppSettings, Object& ppConn) at IBM.Data.DB2.DB2Connection.Open()
未处理的异常:System.Overflow 异常:算术运算导致溢出。在 IBM.Data.DB2.DB2ConnPool.Open(DB2Connection connection, StringszConnectionStringIn, DB2ConnSettings& ppSettings, Object& ppConn) 在 IBM.Data.DB2.DB2Connection.Open()
Download and install the fix for your db2 version from http://www-01.ibm.com/support/docview.wss?uid=swg1IZ09579
从http://www-01.ibm.com/support/docview.wss?uid=swg1IZ09579下载并安装 db2 版本的修复程序
this would fix the problem.
这将解决问题。
回答by Farshid
Install DB2 Express-C for win x64, version 9.7.1 and it would work
为 win x64 版本 9.7.1 安装 DB2 Express-C,它会工作
回答by Amir Shenouda
I had similar issue, my machine is 64 bit. I installed both 32bit and 64 bit db2 run time clients, set the target framework to 32 bit in my project, worked perfectly for me. I was able to run the application on other 64/32 bit machines, just they need to install either the 32bit or the 64 bit from the db2 run time client, depending on the machine OS.
我有类似的问题,我的机器是 64 位。我安装了 32 位和 64 位 db2 运行时客户端,在我的项目中将目标框架设置为 32 位,这对我来说效果很好。我能够在其他 64/32 位机器上运行该应用程序,只是他们需要从 db2 运行时客户端安装 32 位或 64 位,具体取决于机器操作系统。
回答by user3390382
Yes. This should happen in you windows 7 and not in windows xp. The soultion is :
是的。这应该发生在您的 Windows 7 中,而不是在 Windows xp 中。灵魂是:
- right click the project in solution explorer
- Properties
- Compile tab(left side)
- Scroll down to see Advanced Compile optionbutton
- Change the drop down Target Cputo x86.
- 右键单击解决方案资源管理器中的项目
- Properties
- Compile tab(左边)
- 向下滚动以查看Advanced Compile option按钮
- 将下拉菜单更改Target Cpu为 x86。

