NateTut has asked for the wisdom of the Perl Monks concerning the following question:
Of course the appropriate Host, user & password are filled in on the real script. When run it just tries to connect and dies. It doesn't come back from the connect back to the main program. No error messages or warnings either. I have traced it as far as I'm able and it seems to be getting a session number in Teradata.pm but the $dbh seems to be empty.#!/usr/bin/perl # # DBCInfo Query Based on Cannonical Perl DBI connection to Mysql. ###################################################################### +######## use DBI; $host = "Host Address"; # = "localhost", the server your are on. $db = "My User Name"; # your username (= login name = account n +ame ) $user = $db; # your Database name is the same as your accoun +t name. $pwd = "Password"; # Your account password # connect to the database. print(__PACKAGE__ . ':' . __LINE__ . ":Connecting...\n"); $dbh = DBI->connect( "DBI:Teradata:$host", $user, $pwd) or die "Connecting : $DBI::errstr\n "; print(__PACKAGE__ . ':' . __LINE__ . ":Connected.\n"); $sql = "SELECT * FROM DBC.DBCInfo"; # executing the SQL statement. $sth = $dbh->prepare($sql) or die "preparing: ",$dbh->errstr; $sth->execute or die "executing: ", $dbh->errstr; print "content-type: text/html\n\n"; # one of the functions to retrieve data from the table results # check perldoc DBI for more methods. while ($row = $sth->fetchrow_hashref) { foreach(sort(keys(%$row))) { print("$_:\[$row->{$_}\]\n"); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unable to Connect using DBI & DBD-Teradata
by jfroebe (Parson) on Aug 03, 2005 at 13:07 UTC | |
|
Re: Unable to Connect using DBI & DBD-Teradata
by NateTut (Deacon) on Aug 03, 2005 at 12:54 UTC | |
|
Re: Unable to Connect using DBI & DBD-Teradata
by NateTut (Deacon) on Aug 04, 2005 at 15:19 UTC |