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

Nick Gorham nick.gorham at easysoft.com
Thu May 6 09:47:04 BST 2010


Chunmei Wu wrote:
> Hi everyone,  
>    
> I’m using the latest unixODBC 2.3.0 in AIX and DB2, and faced this error  
>                     [IM004][unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed  
>    
> I found similar problem in http://mailman.unixodbc.org/pipermail/unixodbc-support/2006-July/000982.html. Following reply is from Nick:  
> 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  
>    
> The change file said “There is a define for DRV_SQLHANDLE in DriverManager/drivermanager.h that allows this choice at build time”, is there any configuration option related with this choice?  
In the source tree, edit DriverManager/driver_manager.h

Look for:

/*
 * its possible that the driver has a different definition of a handle 
to the driver
 * manager, DB2 64bit is a example of this
 */

#define DRV_SQLHANDLE           SQLHANDLE
#define DRV_SQLHDESC            SQLHDESC

Change the def to

#define DRV_SQLHANDLE           int
#define DRV_SQLHDESC              int

And then

make clean
make

>   
>  
> I found the $ODBCHOME/include/ sqltypes.h is “typedef void * SQLHANDLE;”, should this be “typedef int * SQLHANDLE”?  
>    
No, doing that will also alter the interface to applications which is 
not what is wanted.

-- 
Nick


More information about the unixODBC-support mailing list