[unixODBC-support] Huge problems connecting to a DB2 database.

David Ritter David.Ritter at roguewave.com
Sat Sep 18 02:11:37 BST 2010

Hello Nicklas,

It looks like you are trying to use a 64-bit DB2 client (based on the library you are loading). I believe that you need to use the library libdb2o.so for 64-bit DB2 odbc connectivity.



From: unixodbc-support-bounces at mailman.unixodbc.org [unixodbc-support-bounces at mailman.unixodbc.org] On Behalf Of Nicklas Börjesson [Nicklas.Borjesson at ws.se]
Sent: Friday, September 17, 2010 4:59 PM
To: unixodbc-support at mailman.unixodbc.org
Subject: [unixODBC-support] Huge problems connecting to a DB2 database.

Hi, desperate unixODBC-newbie here..

I have now been trying, for weeks, to connect to a DB2 server using unixodbc.
During this time I have successfully connected to other servers, like MSSQL and others.

But when connecting to DB2, with or wihout DSN, from iSQL or pyODBC, sudo or no sudo, I constantly get this error:
"[IM004] [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed (0) (SQLDriverConnectW)"

I have now tried EVERY trick I have found on the net.
I have tried using libdb2.so-versions for IBM Client 8.1,9.1 and 9.7, always getting the same error.
Output of:

$ odbcinst --v
unixODBC 2.3.0

$ odbcinst -q -d

$ odbcinst -q -s

Currently the ini-files looks like this(confirmed through odbcinst -j:

******** Start ***************************

Description = TDS driver (Sybase/MS SQL)
Driver = /usr/lib/odbc/libtdsodbc.so
Setup = /usr/lib/odbc/libtdsS.so
debug flags = 0xff
CPTimeout =
CPReuse =

Description     = DB2Driverfor9.7
Driver          = /opt/ibm/db2/V9.7/lib64/libdb2.so
FileUsage       = 1
DontDLClose     = 1
******* End ******************************

******** Start ***************************

Trace        = Yes
TraceFile    = /tmp/sql.log
ForceTrace   = Yes

Trace           = Yes
TraceFile       = /tmp/odbc_tr

instance = db2inst1
database = test
driver = DB2_97
server = mydb2server
port = 50000
username = username
password =pw

******** Start ***************************

I am running 64-bits Ubuntu(lucid) on an AMD-64 box.
I have also tried all conceivable attribute names. I think. :-)
I am bordering on losing it and any help would be greatly appreciated!


unixODBC-support mailing list
unixODBC-support at mailman.unixodbc.org

More information about the unixODBC-support mailing list