[unixODBC-support] DB2, Driver's SQLAllocHandle on SQL_HANDLE_HENV failed

Nick Gorham nick.gorham at easysoft.com
Mon Jul 3 18:49:58 BST 2006


Nathan Sandland wrote:

>Hi,
>
>I am trying to connect through unixodbc to a DB2 database, and keep
>getting the following error:
>
>    prak:/home/db2inst2 # isql vigo_prod vcmprod ******** -v
>    [IM004][unixODBC][Driver Manager]Driver's SQLAllocHandle on
>SQL_HANDLE_HENV failed
>    [ISQL]ERROR: Could not SQLConnect
>
>Nearly everything I've found indicates that this error has to do with
>not having the DB2INSTANCE set properly.  However, I have run db2profile
>to do so, and DB2INSTANCE is correct:
>
>    prak:/home/db2inst2 # echo $DB2INSTANCE
>    db2inst2
>
>I am able to connect to DB2 through the db2 command line client:
>
>    db2 => connect to vcmprod user vcmprod
>    Enter current password for vcmprod:
>
>       Database Connection Information
>
>     Database server        = DB2/LINUX 8.1.6
>     SQL authorization ID   = VCMPROD
>     Local database alias   = VCMPROD
>
>Note that I am running 64 bit SUSE linux--perhaps that has something to
>do with it?
>
>  
>
It will be because there is a bug in a version of the 64 bit DB2 driver 
that assumes that a handle is a 32 object, and its not in this case. I 
think IBM have done a fix.  The 2.2.12pre release on the ftp site has a 
way of working around this. from the Change file

    * Allow decoupling of SQLHANDLES between application and driver, 
there is
      a 64bit DB2 where the driver handles are int's but unixODBC uses 
void *.
      There is a define for DRV_SQLHANDLE in 
DriverManager/drivermanager.h that
      allows this choice at build time

-- 
Nick Gorham
Easysoft Limited
http://www.easysoft.com, http://www.unixODBC.org




More information about the unixODBC-support mailing list