Embedd cwbdc.dll from IBM i Client Access manually to console application

1

Is it possible, wo reference the cwbdc.dll which comes with the i Client Access from IBM manually in a console application with C# .Net? I would like to connect to a AS400 database without installing i Client Access but only by using IBM.Data.DB2.iSeries and the provider wich comes with the cwbdc.dll.

When I directly copy the cwbdc.dll to the bin directory I get following exception.

{"An unexpected exception occurred. Type: System.BadImageFormatException, Message: Es wurde versucht, eine Datei mit einem falschen Format zu laden. (Ausnahme von HRESULT: 0x8007000B)."}

c#
dll
db2
asked on Stack Overflow Nov 10, 2017 by Michi-2142

1 Answer

1

I've had a similar problem with the cwbx.dll from IBM. And yes, it's possible.

If you want to copy the dll files without install Client Access, you have to add a Microsoft Patch because this old DLL files are "umanaged dll's" and can't not be loaded directly.

Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package ATL Security Update : https://www.microsoft.com/en-us/download/details.aspx?id=14431

Then you must copy all 320 DLL Files who start with cwb****.dll from the Client Access Installation into your folder with the IBM.Data.DB2.iSeries.dll file. ( they all are referenced in different ways into each other ).

For me has this worked, i could use the iSeries Connection without installing Client Access. But it's a very unstable way. Be sure that when you copy the dll files, that Client Access is not installed on the target machine!

If Client Access is already installed, and you have the dll files included, your application crash. If the Client Access Version from your copied dll's is different from the installed version, your application crash too.

I've fixed this with a check on start => if you find a Client Access Installation, then delete all included dll files and use the installed one.

But even if it works, i do not recommend this way.

answered on Stack Overflow Dec 29, 2017 by Ryfang

User contributions licensed under CC BY-SA 3.0