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

Nick Gorham nick at lurcher.org
Sat Sep 18 02:25:53 BST 2010


  On 18/09/2010 00:59, Nicklas Börjesson wrote:
> 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
I would try setting the

DB2INSTANCE=db2inst1

env var in the actual environment before running isql

export DB2INSTANCE=db2inst1
isql -v FS01DB2

And I would also try renaming the dsn from
FS01DB2 to db2inst1 is the odbc.ini file

-- 
Nick





More information about the unixODBC-support mailing list