Connecting to TD using Perl (ODBC)

Tools & Utilities

Connecting to TD using Perl (ODBC)


I am running into a problem while connecting to TD using Perl. We are in the process of moving our data warehousing from Oracle to TD, and I need to repoint all my automated sqls to run against TD.

I have the DBI and DBD-ODBC modules installed. I created the ODBCs for both our production and test systems, and they do work when using TD SQL ASSISTANT 7.1. For some reason, I am getting an error when connecting via Perl.

This is the error I get:

DBI connect('fsltdtst','r1aabw',...) failed: Specified driver could not be loaded due to system error 126 (Teradata). (SQL-IM003)(DBD: db_login/SQLConnect err=-1) at line 14

$userid = 'r1aabw';
$password = 'Password';
$dsn = 'thisdsn'; # test server. use fsltdprd for production
$dbh = DBI->connect("dbi: ODBC:$dsn", $userid, $password, { RaiseError => 1, odbc_cursortype => 2});

note: there is no space on the $dbh definition after :. Did it to avoid smiley.

line 14 is the $dbh, where I try to establish the connection to TD.

I am assuming it can't find the ODBC driver for some reason, but how can it work for SQL ASSISTANT and not here?

Any ideas what could be happening?

Re: Connecting to TD using Perl (ODBC)

Could the problem be that you reference a different (possibly unintialized) variable "$thisdsn" instead of "$dsn"?

Re: Connecting to TD using Perl (ODBC)

Sorry... I just wanted to eliminate references to our warehouse and changed the code on the post.. I corrected the code on the post. Thanks for pointing that out, but that's not the issue.

Re: Connecting to TD using Perl (ODBC) I rebooted the pc, and when I try to run the connection again I get the following pop-ups:

Message box name: NCR TD.DLL
MessagE: Can't find host

I click OK. The following message box says:
Message box name: NCR TDATA.DLL
Message: 10065 WSA E HostUnreached: The Teratada server cannot be currently reached over this network.