Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Dear All,

I'm creating a winform app in c#, that connects to DB2 database server. Of course I have installed every required db2 extensions on the developer machine, that's why it works on the developer machine.

But after I deploying the app with ClickOnce and starting on the client machine, I always get some error message on the client.

The IBM reference I use in visual studio is IBM.Data.DB2 (version 9.7.4.4)

The error message:
C#
System.EntryPointNotFoundException: Unable to find an entry point named 'SQLFreeConnAttribsADONET' in DLL 'db2app.dll'.


I would like to use the winform app on any client computer without installing any db2 applications.

how should I use this db2app.dll file? I cannot use odbc driver, because in this case I also have to set some parameters on client computer. or is there any other method that I can connect to db2 with?

I have tried all the suggestions found on web, but no success.

Thanks for your help
Posted
Comments
DoomMaker79 14-Jan-16 6:19am    
another error message:

System.DllNotFoundException: Unable to load DLL 'db2app.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I got this, but I have installed the db2 drivers on the client machine where I got this error...
DoomMaker79 14-Jan-16 6:49am    
of course, if I install the ibm data server driver package on client computer, everything's fine. but I have to find a solution without installing anything on client comp.
Richard MacCutchan 14-Jan-16 11:19am    
There is no solution. If your program requires this package to run, then it must be installed on the client computer.
Mirec7 8-Jul-21 4:49am    
For me, installing the Visual C++ Redistributable Packages for Visual Studio 2013 on the target machine helped with DllNotFoundException: Unable to load DLL 'db2app.dll'. See more in my answer below

The 0x8007007E error means you are trying to load a 32-bit DLL in a 64-bit program, or vice-versa.

Assuming the DLL is 32-bit, change your program's target platform from "AnyCPU" to "x86" and recompile.
 
Share this answer
 
Next to the good hint from Richard Deeming, if you still run into problems with DllNotFoundException: Unable to load DLL 'db2app.dll', I have a solution here, which helped me 2 days ago:

My problem was with the NuGet: IBM.Data.DB.Provider version="11.5.4000.4861" targetFramework="net452", which ships with a "clidriver" directory in it, with all necessary DLLs including 64 bit 'db2app64.dll', 32 bit 'db2app.dll' and other stuff to make a DB2 data access possible.

Thanks to Dependency Walker (you can find it on GitHub) I was able to find out, that the MSVCR120.dll was missing on my Windows machine.

I downloaded the Visual C++ Redistributable Packages for Visual Studio 2013 - both the x86 and x64 bit versions (I am running on a 64bit Win10, and 64bit Windows Server 2016 Standard) and installed it in the sequence 1st x86 and then x64 (but you could need e.g. the ARM version for your PC).

After I installed the C++ Redistributable 2013, it worked immediately for me without restarting my computer.

Note, that the "newer" NuGets, like e.g. IBM.Data.DB2.Core.3.1.0.400 have the necessary MSVCR120.dll inside the "clidriver" directory shipped with it, so no C++ Redistributable installation is necessary for them.

You can find my answer (same info) also on StackOverflow.
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900