ODBC Driver fails with error SQLAllocHandle on SQL_HANDLE_ENV failed with tdxodbc64 and Perl

Connectivity

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
7

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

And my odbcinst.ini like so:

  1 [ODBC DRIVERS]
2 Teradata=Installed
3
4 [Teradata]
5 Driver=/mu/sdk/teradata/client/15.10/lib64/tdata.so
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/tdodbc.cat", 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.

2 REPLIES
Enthusiast

Re: ODBC Driver fails with error SQLAllocHandle on SQL_HANDLE_ENV failed with tdxodbc64 and Perl

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.

Thanks,

Atilio

Enthusiast

Re: ODBC Driver fails with error SQLAllocHandle on SQL_HANDLE_ENV failed with tdxodbc64 and Perl

I'm interested as well -- I get this error trying to conenct with PHP/IIS.  The DSN works file for SQL Assistant and Excel can connect to it :(