Why do I get "IM004, Driver's SQLAllocHandle on SQL_HANDLE_HENV failed" connecting to DB2?

This error generally occurs on UNIX because the environment variable DB2INSTANCE has not been set and exported before the Easysoft ODBC-ODBC Bridge Server starts up. You need to either:

  • Edit easysoft_installation_dir/oob/server/server and add:
    DB2INSTANCE=xyz
    export DB2INSTANCE

    before the cd at the end of the file.

    -Or

  • Set DB2INSTANCE and export it before starting esoobserver standalone.

Alternatively, if you are using the unixODBC Driver Manager, you can use SQL_ATTR_UNIXODBC_ENVATTR in the odbc.ini file to set environment variables at DSN-level.