• 1 reply
  • Latest Post - ‏2012-12-04T22:38:15Z by SystemAdmin
17917 Posts

Pinned topic Unable to load DLL db2locale.dll - System.DllNotFoundException

‏2012-12-04T22:03:06Z |
Hi everybody.

I'm going crazy with a new project for a customer of mine.
I need to read/write data from/to an AS/400 (with DB2) from a .NET Windows Forms application.

I downloaded and installed both ibm_data_server_driver_package_win64_v10.1.exe and ibm_data_server_driver_package_win32_v10.1.exe from

Then I created a simple console application that opens a DB2Connection, creates a DB2Command and gets a DB2DataReader instance by calling cmd.ExecuteReader(). Please note that I need to reference the IBM.Data.DB2 assembly pointing it from the "C:\Program Files\IBM\IBM DATA SERVER DRIVER\bin\netf20" folder.

I have the same issue with both the versions of the IBM Data Server Driver (32 and 64 bit). My environment is:
  • Windows 8 Pro x64 (Ita)
  • Visual Studio 2012 with Update 1
  • A simple VB console application (.NET 3.5, x64) - same problem with C#

When I make a call to the ExecuteReader method, I get the following exception:

{"Unable to load DLL 'db2locale64.dll': he specified module could not be found. (Exception from HRESULT: 0x8007007E)."}
System.DllNotFoundException: {"Unable to load DLL 'db2locale64.dll': he specified module could not be found. (Exception from HRESULT: 0x8007007E)."}

(When I try with the 32 bit version, I get the same error on db2locale.dll)

The stack trace is:

System.DllNotFoundException: {"Unable to load DLL 'db2locale64.dll': he specified module could not be found. (Exception from HRESULT: 0x8007007E)."}.
in IBM.Data.DB2.UnsafeNativeMethods.DB2InteropAPP.sqloGetNormalizedLangFromLangId(Int16 lcid)
in IBM.Data.DB2.UnsafeNativeMethods.DB2Locale.sqloGetNormalizedLangFromLangId(Int16 lcid)
in IBM.Data.DB2.DB2Resource.a(CultureInfo A_0, String A_1)
in IBM.Data.DB2.DB2Resource..ctor(CultureInfo cultureInfo, String szResFileName, String szMsgPath)
in IBM.Data.DB2.DB2Resource..ctor(CultureInfo cultureInfo, String szResFileName)
in IBM.Data.DB2.DB2Resources.a(CultureInfo A_0)
in IBM.Data.DB2.DB2Resources.GetString(String stringID, String[] tokens)
in IBM.Data.DB2.Res.GetString(String name, String[] args)
in IBM.Data.DB2.ADP.OpenConnectionRequired(String method, ConnectionState state)
in IBM.Data.DB2.DB2Connection.SetStateExecuting(String method, DB2Transaction transaction)
in IBM.Data.DB2.DB2Command.a(String A_0)
in IBM.Data.DB2.DB2Command.ExecuteReaderObject(CommandBehavior behavior, String method, DB2CursorType reqCursorType, Boolean abortOnOptValueChg, Boolean skipDeleted, Boolean isResultSet, Int32 maxRows, Boolean skipInitialValidation)
in IBM.Data.DB2.DB2Command.ExecuteReaderObject(CommandBehavior behavior, String method)
in IBM.Data.DB2.DB2Command.ExecuteReader(CommandBehavior behavior)
in IBM.Data.DB2.DB2Command.ExecuteReader()
in TestDb2.Module1.TestDB2Read() in ...

I tried everything but with no success.

Can anyone help me?

Thank you.

Kind regards,
  • SystemAdmin
    17917 Posts

    Re: Unable to load DLL db2locale.dll - System.DllNotFoundException

    Maybe I found the solution by myself but I'm not sure this is the official solution.
    From my point of view, there is something that is not so clear.
    I'm not able to find documentation about how to setup the DB2 Data Driver environment.

    I copied some files from the IBM/bin folder, to my destination folder (where I have the .exe file running):

    db2locale.dll (I'm trying with x86) to ./
    IBM.DB2.APP.manifest to ./
    x86.VC10.CRT/* to ./
    x86.VC10.MFC/* to ./
    ../msg/* to ../msg/

    Now the application seems to run.
    I will make more tests tomorrow when I will able to connect to the DB2 host.

    Kind regards.