views:

268

answers:

1

I'm trying to connect to a AS400 server using the .net classes.
I have added a reference to IBM.Data.DB.iSeries and I use the following code:
var conn = new iDB2Connection("DataSource=111.111.111.111;UserID=xxx;Password=xxx; DataCompression=True;");
conn.Open();

But I get the following exceptions
Running 64 bit: "The provider cannot run in 64-bit mode."
Running 32 bit: An unexpected exception occurred. Type: System.DllNotFoundException, Message: Unable to load DLL 'cwbdc.dll': The operating system cannot run . (Exception from HRESULT: 0x800700B6).

I have uninstalled the Client Access and installed it again. The cwbdc.dll does exist in the system32 and syswow64 . I have no problem connecting to the AS400 if I use odbc.

I'm running a 64 bit verion of Windows 7.
Any ideas?

/Jimmy

+1  A: 

It seems that the driver you are using is not supported on 64 bit systems. In the properties of your project in the Build tab try setting the Platform Target to x86 instead of Any CPU.

Darin Dimitrov
When setting it to x86 I get the other errormessage: "An unexpected exception occurred. Type: System.DllNotFoundException, Message: Unable to load DLL 'cwbdc.dll': The operating system cannot run . (Exception from HRESULT: 0x800700B6)."
Jimmy Engtröm