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

Chunmei Wu chunmei.wu at oracle.com
Fri May 7 03:13:58 BST 2010


Hi Nick,

Thanks for your kind reply.

I tried your suggestion, but same error still occur. Following is my procedure:
1> set following env
setenv OBJECT_MODE 64
setenv CFLAGS -q64 
setenv CC xlc_r
setenv CCC xlC_r

2> Run configure 
./configure --prefix=/home/eng-sm/unixuser/claire/test/perl/unixodbc_install2.3.0_64 --enable-gui=no --enable-drivers=no

3> edit DriverManager/driver_manager.h
		#define DRV_SQLHANDLE           SQLHANDLE
		#define DRV_SQLHDESC            SQLHDESC
		
		Change the def to
		
		#define DRV_SQLHANDLE           int
		#define DRV_SQLHDESC              int

4> make clean
   make
   make install
 
5> cd $ODBCHOME/bin
   unixuser\@dsliaa05 # > isql -v Q10F qadmin qadmin
		[IM004][unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed
		[ISQL]ERROR: Could not SQLConnect


Thanks,
Chunmei Wu

-----Original Message-----
From: Nick Gorham [mailto:nick.gorham at easysoft.com] 
Sent: 2010年5月6日 16:47
To: Support for the unixODBC project
Subject: Re: [unixODBC-support] DB2, Driver's SQLAllocHandle on SQL_HANDLE_HENV

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
_______________________________________________
unixODBC-support mailing list
unixODBC-support at mailman.unixodbc.org
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support


More information about the unixODBC-support mailing list