SQLSTATE IM004, SQLAllocHandle on SQL_HANDLE_ENV failed, when connecting via an ODBC application
This document provides troubleshooting information for the situation where you are attempting to connect to a DB2 UDB database within an ODBC application and receive a message such as the following:
SQLSTATE = IM004
Native error = 0
Msg:[Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed.
The new security features introduced in DB2® Universal Database™ (DB2 UDB) Version 8.2 prevent users from using the database unless they belong to the Windows® groups DB2ADMNS or DB2USERS.
In this situation, the message may not appear within CLI traces and an ODBC trace may just indicate that the SQLConnectW() call fails.
Add the userid (the one used to execute the application) to either the DB2ADMNS or DB2USERS group. Please refer to the link under "Related Information" (below) for instructions on how to accomplish this.
As of DB2 UDB Version 8.1 FixPak 10 (also known as DB2 UDB Version 8.2 FixPak 3), a clearer error message will be returned in situations where enhanced security have been enabled and a userid does not meet these qualifications.
This is accomplished via APAR JR20697 with the message below:
SQL1092N "<authorization-ID>" does not have the authority to perform the requested command.
More support for:
DB2 for Linux, UNIX and Windows
Database Objects/Config - Authorization/Privilege
Software version: 8.2, 9.1, 9.5, 9.7, 10.1, 10.5, 11.1
Operating system(s): Windows
Reference #: 1229860
Modified date: 19 June 2008