Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Error connecting to Teradata via ODBC

by MoFiddy (Sexton)
on Dec 02, 2010 at 16:21 UTC ( [id://874933]=perlquestion: print w/replies, xml ) Need Help??

MoFiddy has asked for the wisdom of the Perl Monks concerning the following question:

Hello all, I'm having trouble connecting to Teradata using ODBC. The error that I am receiving is... DataDirectODBC lib Specified driver could not be loaded (SQL-IM003)(DBD: db_login/SQLConnect err=-1) at ... I know that my username and password are correct. I think that I might be missing something in my environment setup though. Here is the code in question:
use strict; use File::Basename; use Cwd; use Date::Calc qw(Today Now); use Sys::Hostname; use DBI; use DBD::ODBC::Teradata; eval { my $tddsn = "odbc_entry"; my $tduser = "username"; my $tdpass = "password"; $ENV{'ODBCINI'} = '/path/to/.odbc.ini'; my $tddbh = DBI->connect("DBI:ODBC:DSN=$tddsn", $tduser, $tdpass, +{PrintError => 0, RaiseError => 0 }) or die $DBI::errstr; } unless ($@);
Thanks for your help.

Replies are listed 'Best First'.
Re: Error connecting to Teradata via ODBC
by Generoso (Prior) on Dec 02, 2010 at 16:35 UTC

    Have you tested your connection for DSN=odbc_entry in Data Sources (ODBC)?

      Hi Generoso, That is a good question. Our server is Solaris, so I poked around and found /opt/teradata/client/odbc64/samples/C. I ran the adhoc program, but discovered that the file that I am referencing in my code ($ENV{'ODBCINI'} = '/path/to/.odbc.ini';) is NOT the same odbc.ini file that /opt/teradata/client/odbc64/samples/C references. It seems that I need to add my dsn entry to /opt/teradata/client/odbc64/odbc.ini for it to work. Do I also need to add it to odbcinst.ini too? Is that correct? Am I on the right track? Thanks Edit: Added sentence about odbcinst.ini.
        It turns out that the problem was that I was using 64-bit odbc drivers. Our version of Perl only supports 32-bit at this time. I changed the odbc entry to point to the 32-bit drivers and I was able to connect. Thanks for your help! Dennis
Re: Error connecting to Teradata via ODBC
by mje (Curate) on Dec 02, 2010 at 17:26 UTC

    You are not alone - see DBD::ODBC to Teradata where the poster got it working eventually. I have not got the DataDirect ODBC Driver Manager because you need to pay for it (and I've not got teradata either).

    The error you refer to suggests the ODBC Driver manager (whichever one you are using) cannot load the driver shared object so you've either specified it incorrectly in the DSN or Driver settings or it depends on something that is not on the dynamic linker path.

      Thanks. That is helpful.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://874933]
Approved by sweetblood
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-29 10:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found