[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.

http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.cli.doc/doc/t0006349.htm

Hth,
Dave

________________________________________
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
[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



_______________________________________________
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