<p>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:</p>

<blockquote>
  <p>SQL1159 Initialization error with DB2 .NET Data Provider, reason code 7, tokens 9.5.0.DEF.2, SOFTWARE\IBM\DB2\InstalledCopies</p>
</blockquote>

<p>There are several <a href="http://www-128.ibm.com/developerworks/forums/thread.jspa?threadID=207638&amp;tstart=45" rel="nofollow noreferrer">IBM forum posts</a> mentioning it, but little useful guidance.  Has anyone experienced this before?  Or do you have better ideas for fixing it?</p>

[{'answer_id': 29425, 'author': 'Booji Boy', 'author_id': 1433, 'author_profile': 'https://Stackoverflow.com/users/1433', 'pm_score': 1, 'selected': False, 'text': '<p>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. </p>\n'}, {'answer_id': 29428, 'author': 'Michael Sharek', 'author_id': 1958, 'author_profile': 'https://Stackoverflow.com/users/1958', 'pm_score': 1, 'selected': False, 'text': '<p>I assume you have seen the writeup of <a href="http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.msg.doc/doc/sql1159.htm" rel="nofollow noreferrer">SQL1159</a> in the <a href="http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp" rel="nofollow noreferrer">DB2 Reference Guide</a>?</p>\n\n<p>Unfortunately for you, the reason codes stop at 6 and don\'t continue to 7.  It does say:</p>\n\n<blockquote>\n  <p>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.</p>\n</blockquote>\n\n<p>So I guess try to reinstall it and if the problem continues you\'ll have to contact IBM.</p>\n\n<p>Sorry, I know that\'s not much help.</p>\n'}, {'answer_id': 29914, 'author': 'Mark Brackett', 'author_id': 2199, 'author_profile': 'https://Stackoverflow.com/users/2199', 'pm_score': 3, 'selected': True, 'text': "<p>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.</p>\n\n<p>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.</p>\n"}, {'answer_id': 31478, 'author': 'jsight', 'author_id': 1432, 'author_profile': 'https://Stackoverflow.com/users/1432', 'pm_score': 0, 'selected': False, 'text': "<p>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. :)</p>\n"}, {'answer_id': 253172, 'author': 'icelava', 'author_id': 2663, 'author_profile': 'https://Stackoverflow.com/users/2663', 'pm_score': 0, 'selected': False, 'text': '<p>I encountered this error on a Windows 2003 x86 server as well. Originally my problem was</p>\n\n<blockquote>\n  <p>Unable to find the requested .net\n  framework data provider. it may not be\n  installed.</p>\n</blockquote>\n\n<p>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 <em>more</em> than just editing machine.config.</p>\n\n<p>Evenutally I uninstalled the IBM DB2 driver set, reboot the system, reinstalled it, and got it initializing connections properly.</p>\n'}, {'answer_id': 866115, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>Just as a quick note...</p>\n\n<p>@Micheal: the link you had for SQL1159 is to the Version 9.1 docs<br/>\nThe Version 9.5 documentation goes up to reason code 9<br/>\n<a href="http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.messages.sql.doc/doc/msql01159n.html" rel="nofollow noreferrer">http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.messages.sql.doc/doc/msql01159n.html</a></p>\n\n<p>Unfortunately, I think there is a 10th reason code that is undocumented there but it is in a developerWorks topic<br/>\n<a href="http://www.ibm.com/developerworks/wikis/display/DB2/DB2+and+.NET+FAQ#DB2and.NETFAQ-WhatisSQL1159InitializationError%3F" rel="nofollow noreferrer">http://www.ibm.com/developerworks/wikis/display/DB2/DB2+and+.NET+FAQ#DB2and.NETFAQ-WhatisSQL1159InitializationError%3F</a></p>\n'}, {'answer_id': 2066246, 'author': 'Farshid', 'author_id': 250952, 'author_profile': 'https://Stackoverflow.com/users/250952', 'pm_score': 0, 'selected': False, 'text': '<p>I had the same problem with DB2 .net provider.</p>\n\n<p>If you have windows 64 bit then download and install\nIBM Data Server Runtime Client (Windows AMD 64) Version  9.5<br>\nfrom \n_https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?lang=en_US&amp;source=swg-idsrc11&amp;S_TACT=appddnet&amp;S_CMP=ibm_im</p>\n\n<p>If you run your program you would get the following exception</p>\n\n<p>Unhandled Exception: System.Overflow Exception: Arithmetic\noperation resulted in an overflow.\n   at IBM.Data.DB2.DB2ConnPool.Open(DB2Connection connection,\nStringszConnectionStringIn, DB2ConnSettings&amp; ppSettings, Object&amp;\nppConn)\n   at IBM.Data.DB2.DB2Connection.Open()</p>\n\n<p>Download and install the fix for your db2 version from\n<a href="http://www-01.ibm.com/support/docview.wss?uid=swg1IZ09579" rel="nofollow noreferrer">http://www-01.ibm.com/support/docview.wss?uid=swg1IZ09579</a></p>\n\n<p>this would fix the problem.</p>\n'}, {'answer_id': 2090278, 'author': 'Farshid', 'author_id': 250952, 'author_profile': 'https://Stackoverflow.com/users/250952', 'pm_score': 0, 'selected': False, 'text': '<p>Install DB2 Express-C for win x64, version 9.7.1\nand it would work </p>\n'}, {'answer_id': 9854279, 'author': 'Amir Shenouda', 'author_id': 1219299, 'author_profile': 'https://Stackoverflow.com/users/1219299', 'pm_score': 0, 'selected': False, 'text': '<p>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.</p>\n'}, {'answer_id': 22237737, 'author': 'user3390382', 'author_id': 3390382, 'author_profile': 'https://Stackoverflow.com/users/3390382', 'pm_score': 0, 'selected': False, 'text': '<p>Yes. This should happen in you windows 7 and not in windows xp. The soultion is :</p>\n\n<ul>\n<li>right click the project in solution explorer </li>\n<li><kbd>Properties</kbd></li>\n<li><kbd>Compile tab</kbd> (left side)</li>\n<li>Scroll down to see <kbd>Advanced Compile option</kbd> button </li>\n<li>Change the drop down <kbd>Target Cpu</kbd> to x86.</li>\n</ul>\n'}]
['https://Stackoverflow.com/questions/29370', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1432/']