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:

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.