All Forums Connectivity
jkoenes 3 posts Joined 07/15
13 Aug 2015
ODBC Driver fails with error SQLAllocHandle on SQL_HANDLE_ENV failed with tdxodbc64 and Perl

As the title says, the driver fails connecting on a RHEL 5-64bit system in a custom directory, running tdxodbc64, and gives the above error, like so:

Enter Data Source Name: DSNtest
Enter UserID: jkoenes
Enter Password:

Connecting with SQLConnect(DSN=DSNtest,UID=jkoenes,PWD=*)...

adhoc: (SQL Diagnostics) STATE=IM004, CODE=0, MSG=[DataDirect][ODBC lib] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed

ODBC connection closed.

The same with a simple Perl script, using dbi and DBD::ODBC
 $connection = DBI->connect('dbi:ODBC:DSNtest','jkoenes','*******') or die "Could not connect for some reason";
My odbc.ini file looks like so:

  1 [ODBC]
  2 InstallDir=/mu/sdk/teradata/client/15.10/odbc_64
  3 Trace=0
  4 TraceDll=
  5 TraceFile=
  6 TraceAutoStop=0

 11 [DSNtest]
 12 Driver=/mu/sdk/teradata/client/15.10/lib64/
 13 Description=Teradata Test Database with Teradata ODBC 15.10
 14 DBCName=<ip address>

And my odbcinst.ini like so:

  2 Teradata=Installed
  4 [Teradata]
  5 Driver=/mu/sdk/teradata/client/15.10/lib64/
  6 Description=Teradata ODBC 15.10
  7 APIlevel=CORE
  8 ConnectFunctions=YYY
  9 DriverODBCVer=3.51
 10 SQLLevel=1

Both are located in my home directory, with a preceding dot, and my LD_LIBRARY_PATH is already set to look at the install directory for tdodbc.
Doing an strace of these, and I ran into two interesting parts:

472 5512  open("H\215\203\370\20/15.10/odbc_64/msg/tdodbc", O_RDONLY) = -1 ENOENT (No such file or directory)
473 5512  open("H\215\203\370\20/15.10/odbc_64/msg/", O_RDONLY) = -1 ENOENT (No such file or directory)

and the log error with it that could be a hint:

480 5512  sendto(3, "<12>Aug 13 13:55:16 tdodbc[5512]:  connect.cpp SQLAllocEnv 1 : Could not open message filetdodbc", 96, MSG_NOSIGNAL, NULL, 0) = 96

In hindsight, the tdxodbc64 program was throwing "free() invalid pointer" errors until I set MALLOC_CHECK_=0, and I realized it was because the above tdodbc files couldn't be found. I don't know what is causing the SQLAllocHandle error, but the above lines seem to be a good start.  I've tried setting NSLPATH to the directory where the .cat files are, but it had no affect on the above lines. I've also double checked that all dependencies were satisfied, so I am 99.9999999% sure it's not a dependency issue. Any help at all on this matter would be wonderful.

atiliomedina 5 posts Joined 04/16
25 Apr 2016

Hi jkoenes;
Were you ever able to determine the source of this issue? I am getting the same error on an installation for CentOS 7 with the 15.10 driver.

You must sign in to leave a comment.