Frosty840
Frosty840

Reputation: 8335

IBM .net driver cannot find db2locale.dll

I'm trying to pull a Git repository of my .net solution over to another folder on the same machine (just to make sure it works).

In the project I use that creates IfxConnections, when I try to create a new IfxConnection I get a DllNotFoundException, which is thrown by the IBM Informix driver.

The message I receive is "Unable to load DLL 'db2locale.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)" and the stack trace (reading back to the constructor call) is:

at IBM.Data.Informix.UnsafeNativeMethods.IfxInteropAPP.sqloGetNormalizedLangFromLangId(Int16 lcid)
at IBM.Data.Informix.UnsafeNativeMethods.IfxLocale.sqloGetNormalizedLangFromLangId(Int16 lcid)
at IBM.Data.Informix.IfxResource.GetMsgPath(CultureInfo cultureInfo, String szResFileName)
at IBM.Data.Informix.IfxResource..ctor(CultureInfo cultureInfo, String szResFileName, String szMsgPath)
at IBM.Data.Informix.IfxResource..ctor(CultureInfo cultureInfo, String szResFileName)
at IBM.Data.Informix.IfxResources.GetResource(CultureInfo cultureInfo)
at IBM.Data.Informix.IfxResources.GetString(CultureInfo cultureInfo, String stringID)
at IBM.Data.Informix.Res.GetString(CultureInfo culture, String name)
at IBM.Data.Informix.ODC.InvalidArgument()
at IBM.Data.Informix.IfxConnPool.ReplaceConnectionStringParms(IfxConnection connection, String szValue, IfxConnSettings& pSettings, IfxConnSettingsInternal& pSettingsInternal, Boolean bAttach)
at IBM.Data.Informix.IfxConnection.set_ConnectionString(String value)
at IBM.Data.Informix.IfxConnection..ctor(String connectionString)

The thing is, my code/project does not directly reference this dll. My code references IBM.Data.Informix on the local machine path C:\Program Files\IBM\IBM DATA SERVER DRIVER\bin\netf40_32\IBM.Data.Informix.dll, as it does in all of my other projects, and in the repository from which this repository has been cloned. Opening the original project from the repository produces no errors.

Can anyone give me some insight into why this error is occurring and what I can do to fix it?

As an aside, the IBM Informix driver seems to use a lot of the DB2 connection code in the background to the extent that, in other projects, which use designer-generated datasets, I can only connect to my Informix database using the DB2 connector type. Hence the DB2 tag, even though it's not immediately obvious why this would be DB2-related.

Upvotes: 3

Views: 2509

Answers (1)

Satyan
Satyan

Reputation: 56

The IBM Informix .NET drivers what you are using is from IBM DB2 Data Server Driver package; it is not the native Informix .NET provider. In ideal case if the IBM DB2 Data Server Driver package is installed correctly then you should not see this error.

If your intention is to use the native Informix .NET drivers then you may need to dereference the current binary that you have included with the project and then make a reference to native Informix .NET drivers. The location of the native Informix .NET provider is $INFORMIXDIR\bin\netf20\IBM.Data.Informix.dll

FYI: There are two flavors of IBM Informix .NET drivers, both of them have same namespace (IBM.Data.Informix) and same binary name (IBM.Data.Informix.dll).

One of them uses Informix native (SQLI) protocol and the other one uses DRDA protocol. The IBM Informix .NET drivers with native protocol is part of IBM Informix Client SDK The one that uses DRDA protocol is part of IBM DB2 Data Server Driver package.

Now IBM Informix Client SDK includes IBM DB2 Data Server Driver package also as an optional component during the installation.

Upvotes: 4

Related Questions