Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^2: DBD::ODBC to Teradata

by DanEllison (Beadle)
on Nov 05, 2010 at 19:24 UTC ( #869736=note: print w/replies, xml ) Need Help??

in reply to Re: DBD::ODBC to Teradata
in thread DBD::ODBC to Teradata

My script looks as follows:

#! /bin/perl use strict; use DBI; use DBD::ODBC; DBI->trace(DBD::ODBC->parse_trace_flag('odbcconnection')); my $dbh = DBI->connect('dbi:ODBC:nhitest','delli28','XXXXXXX'); my $sth = $dbh->prepare("SELECT * FROM dbc.databases"); $sth->execute; while (my $row = $sth->fetchrow_hashref) { print "Name: $$row{DatabaseName}, Owner: $$row{OwnerName}\n"; #print "Name: $$row{TABNAME}, Owner: $$row{OWNER}\n"; } $dbh->disconnect;

The results look as follows:

delli28@apsa9012:/u/delli28> non-Unicode login6 dbd_db_login6 SQLDriverConnect 'nhitest', 'delli28', 'xxxx' SQLConnect 'nhitest', 'delli28' Turning autocommit on Illegal instruction

isql output looks as follows:

delli28@apsa9012:/u/delli28> isql -v nhitest delli28 XXXXXXX +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ SQL> select DatabaseName from DBC.Databases +-------------------------------+ | DatabaseName | +-------------------------------+ | gkopf | ...

Replies are listed 'Best First'.
Re^3: DBD::ODBC to Teradata
by kcott (Chancellor) on Nov 05, 2010 at 21:45 UTC

    Here's some troubleshooting procedures you can try.

    Make these changes to your code:

    #DBI->trace(DBD::ODBC->parse_trace_flag('odbcconnection')); # Note: parse_trace_flags ('s' at the end) here: DBI->trace(DBD::ODBC->parse_trace_flags('5|odbcconnection|odbcunicode' +)); #my $dbh = DBI->connect('dbi:ODBC:nhitest','delli28','XXXXXXX'); my $connect_attrs = { PrintError => 0, RaiseError => 1, AutoCommit => +1 }; my $dbh = DBI->connect('dbi:ODBC:nhitest','delli28','XXXXXXX', $connec +t_attrs);

    Here's references to the documentation for those changes:

    You can try running with AutoCommit => 1 and AutoCommit => 0.

    You can increase the trace level from 5 up to 15.

    -- Ken

      I made the changes you suggested and got a little more output, but I'm not sure what this telling me... except is this showing a failure before trying to set autocommit, possibly on a dead connection?

      delli28@apsa9012:/u/delli28> DBI 1.615-ithread default trace level set to 0x6000000/15 (pid 888 +884 pi 20009e68) at line 8 -> DBI->connect(dbi:ODBC:nhitest, delli28, ****, HASH(0x2000ab38)) -> DBI->install_driver(ODBC) for aix perl=5.008008 pid=888884 ruid +=43679 euid=43679 install_driver: DBD::ODBC version 1.25 loaded from /u/delli28/l +ib/site_perl/5.8.8/aix-thread-multi/DBD/ New 'DBI::dr' (for DBD::ODBC::dr, parent='', id=undef) dbih_setup_handle(DBI::dr=HASH(0x2052e7d4)=>DBI::dr=HASH(0x2052d27 +c), DBD::ODBC::dr, 0, Null!) dbih_make_com(Null!, 0, DBD::ODBC::dr, 92, 0) thr#20009e68 dbih_setup_attrib(DBI::dr=HASH(0x2052d27c), Err, Null!) SCALAR(0x2 +0411574) (already defined) dbih_setup_attrib(DBI::dr=HASH(0x2052d27c), State, Null!) SCALAR(0 +x204115bc) (already defined) dbih_setup_attrib(DBI::dr=HASH(0x2052d27c), Errstr, Null!) SCALAR( +0x20411598) (already defined) dbih_setup_attrib(DBI::dr=HASH(0x2052d27c), TraceLevel, Null!) 0 ( +already defined) dbih_setup_attrib(DBI::dr=HASH(0x2052d27c), FetchHashKeyName, Null +!) 'NAME' (already defined) install_method DBI::st::odbc_lob_read <- install_driver= DBI::dr=HASH(0x2052e7d4) >> connect DISPATCH (DBI::dr=HASH(0x2052e7d4) rc2/3 @5 g0 ima8 +001 pid#888884) at /u/delli28/lib/site_perl/5.8.8/aix-thread-multi/DB line 665 !! warn: 0 CLEARED by call to connect method -> connect for DBD::ODBC::dr (DBI::dr=HASH(0x2052e7d4)~0x2052d27c +'nhitest' 'delli28' **** HASH(0x2025d028)) thr#20009e68 New 'DBI::db' (for DBD::ODBC::db, parent=DBI::dr=HASH(0x2052d27c), + id=undef) dbih_setup_handle(DBI::db=HASH(0x2052ebdc)=>DBI::db=HASH(0x2052eb4 +0), DBD::ODBC::db, 204a3608, Null!) dbih_make_com(DBI::dr=HASH(0x2052d27c), 205342f8, DBD::ODBC::db, 4 +48, 0) thr#20009e68 dbih_setup_attrib(DBI::db=HASH(0x2052eb40), Err, DBI::dr=HASH(0x20 +52d27c)) SCALAR(0x204a3794) (already defined) dbih_setup_attrib(DBI::db=HASH(0x2052eb40), State, DBI::dr=HASH(0x +2052d27c)) SCALAR(0x204a37f4) (already defined) dbih_setup_attrib(DBI::db=HASH(0x2052eb40), Errstr, DBI::dr=HASH(0 +x2052d27c)) SCALAR(0x204a37c4) (already defined) dbih_setup_attrib(DBI::db=HASH(0x2052eb40), TraceLevel, DBI::dr=HA +SH(0x2052d27c)) 0 (already defined) dbih_setup_attrib(DBI::db=HASH(0x2052eb40), FetchHashKeyName, DBI: +:dr=HASH(0x2052d27c)) 'NAME' (already defined) dbih_setup_attrib(DBI::db=HASH(0x2052eb40), HandleSetErr, DBI::dr= +HASH(0x2052d27c)) undef (not defined) dbih_setup_attrib(DBI::db=HASH(0x2052eb40), HandleError, DBI::dr=H +ASH(0x2052d27c)) undef (not defined) dbih_setup_attrib(DBI::db=HASH(0x2052eb40), ReadOnly, DBI::dr=HASH +(0x2052d27c)) undef (not defined) dbih_setup_attrib(DBI::db=HASH(0x2052eb40), Profile, DBI::dr=HASH( +0x2052d27c)) undef (not defined) non-Unicode login6 dbd_db_login6 !!dbd_error2(err_rc=0, what=db_login/SQLAllocHandle(env), handles= +(0,0,0) SQLDriverConnect 'nhitest', 'delli28', 'xxxx' SQLDriverConnect failed: SQLConnect 'nhitest', 'delli28' Turning autocommit on Illegal instruction delli28@apsa9012:/u/delli28>

        Both the README and the FAQ (re connection problems) stress the importance of testing drivers, configuration and so on. So it's worth double checking those aspects.

        Googling: SQLDriverConnect failed AIX Teradata produced quite a few hits which may be of use.

        You have the latest DBD::ODBC version (1.25). There's a more recent development version (1.26_1) which you could try (although I didn't see anything in its Changes file which appeared to address your issue).

        If none of that works I'd raise a bug report.

        -- Ken

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://869736]
What's the matter? Cat got your tongue?...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2017-05-29 01:38 GMT
Find Nodes?
    Voting Booth?