[unixODBC-support] why does it not connect to Oracle Express?

Ken Resander kresander at yahoo.com
Wed May 13 19:04:12 BST 2009

I have DB2, MySQL, Mimer SQL and SQL Anywhere connect successfully via unixODBC on Ubuntu 8.10, but Oracle Express 10g is giving me a hard time.

I am getting this error on SQLConnect when trying to connect to Oracle's HR sample database on my local PC:

Usage error: SQLConnect: dsn=TestDBDSN, user=hr, password=hr <<-- by my code
1: st=IM004, nerr=0, msg=
[unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed


Driver = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libsqora.so.10.1 
Description = Oracle 10g express driver

Application Attributes = T
Attributes = W
BatchAutocommitMode = IfAllSuccessful
CloseCursor = F
DisableDPM = F
DisableMTS = T
Driver = OracleExpressdrv
EXECSchemaOpt =
EXECSyntax = T
Failover = T
FailoverDelay = 10
FailoverRetryCount = 10
FetchBufferSize = 64000
ForceWCHAR = F
Lobs = T
Longs = T
MetadataIdDefault = F
QueryTimeout = T
ResultSets = T
# ServerName is TNS_alias_from_tnsnames.ora
ServerName = XE
SQLGetData extensions = F
Translation DLL =
Translation Option = 0
UserID = hr

I have posted about this in Oracle Linux forum, Oracle Express forum and on DBforums forum, but no one seems to know. 

I have googled for days on 'IM004' and 'SQLAllocHandle on SQL_HANDLE_HENV failed' etc and received matches, but most of them old, for Windows or other db products. Some posts have suggested 'set environment variable so-and-so', which have done by adding to the bash login script. These 

#  Added by ken for oracle

ODBCINI=/etc/odbc.ini;export ODBCINI
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0;export ORACLE_HOME
TNS_ADMIN=$ORACLE_HOME/server/network/admin;export TNS_ADMIN
LD_LIBRARY_PATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib;export LD_LIBRARY_PATH


but still no luck.

Oracle® Database
Administrator’s Reference
10g Release 2 (10.2) for UNIX-Based Operating Systems
March 2009

contains information about ODBC using unixODBC in appendix G, but none of it helped. I have not found any other Oracle documentation about ODBC for Linux. The Oracle Admin Reference says that error messages formatted [unixODBC][Driver Manager]message-text are output by the unixODBC driver manager, so I checked and found that the message text 'Driver's SQLAllocHandle on SQL_HANDLE_HENV failed' is set in _info.c, post_internal_error for case ERROR_IM004.

It is hard for me to understand the unixodbc driver code. Is there any error information coming from the Oracle driver that may hint at a solution? Do you know if anyone has managed to connect to Oracle Express on Linux?

I really don't want to give up on this, but...

P.S. when googling I found some posts containing unixODBC tracing code.
How do I turn tracing ON?

      Get your new Email address!
Grab the Email name you&#39;ve always wanted before someone else does!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20090513/b208a3a7/attachment.html>

More information about the unixODBC-support mailing list