Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 11 May 2005 @ 14:14:37 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Need a program to test Unix ODBC install for Teradata
 
From:   Dittrich, Klaus

Bradley,

we use Perl-DBI with Teradata a lot for years, at least for our software development (and now starting to use it in production also), and it works very well.

Most problems occur with non-matching versions of the different tools/drivers; the versions we currently use are (at least this is the latest configuration I tested):

     Sun-Solaris 8
     Perl 5.8.6
     DBI 1.46
     DBD::ODBC 1.13
     TTU 7.0
     ODBC 3.2.0.9
     Teradata V2R5

This works fine currently, also on Teradata V2R5.1.

C or C++ is currently not used by us under Unix to access Teradata.

Here's a little sample program that I normally use in some variations to test the connection (can also be used for other DBMS; adjustments to the environment may be needed).

     --- BEGIN perl_dbi_test.pl
     #!/bin/sh -- # perl, to stop looping
     eval 'exec $PERLBINDIR/perl -w -S $0 ${1+"$@"}'
       if $sh; $sh = undef;
     ###
     #
     # Sample Perl-DBI-Program for Teradata
     #
     # Klaus Dittrich  Vodafone D2 GmbH
     # 01.03.2005
     #
     ###

     # use correct perl version and other libraries use DBI;
     use lib "/home/dwh/lib/dwhgen";

     # DBI-Trace-Mode
     #DBI->trace(3); # activate in case of any problems

     # Check available Drivers
     printf "Available Driver:\n %s\n", join(' ',DBI->available_drivers);
     # Check available Sources
     printf "Available ODBC-Sources:\n %s\n\n",  join("\n
     ",DBI->data_sources(ODBC));

     # Open Connection
     my $dbhandle = DBI->connect("dbi:ODBC:testdsn",,)
         or die "$DBI::errstr\n";
     # Define Query to send
     # Teradata
        $query = "SELECT * from dbc.dbcinfo";
        $sth = $dbhandle->prepare($query) or die "$DBI::errstr\n";;
     # Execute Query
        $sth->execute() or die "$DBI::errstr\n";;
     # Output
        while (@input =  $sth->fetchrow_array){
             print "@input \n";
        }
        if ($DBI::err) {
             print $DBI::errstr . "\n";
        }
     # Disconnect
     $dbhandle->disconnect;

     exit 0;
     --- END

Klaus Dittrich
Fachreferent Global Data Warehouse Systems
Abteilung Data Warehouse



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023