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

Nicklas Börjesson Nicklas.Borjesson at ws.se
Sat Sep 18 00:59:32 BST 2010


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
[FreeTDS]
[DB2_97]

$ odbcinst -q -s 
[ODBC]
[FS01DB2]


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

odbcinst.ini:
******** Start ***************************

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

[DB2_97]
Description     = DB2Driverfor9.7 
Driver          = /opt/ibm/db2/V9.7/lib64/libdb2.so
FileUsage       = 1
DontDLClose     = 1
DMEnvAttr       = SQL_ATTR_UNIXODBC_ENVATTR= {DB2INSTANCE=db2inst1}
******* End ******************************

odbc.ini:
******** Start ***************************

[ODBC]
Trace        = Yes
TraceFile    = /tmp/sql.log
ForceTrace   = Yes
ODBC]

Trace           = Yes
TraceFile       = /tmp/odbc_tr

[FS01DB2]
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!

//NIcklas





More information about the unixODBC-support mailing list