Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 22 Jun 2000 @ 21:39:47 GMT


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


Subj:   Re: C Preprocessor2 Alternatives
 
From:   Mark Landry

I've attached a sample program so you can see how it works.

     #!/usr/local/bin/perl

     # sample code to access Teradata tables using ODBC from NT or Unix

     use DBI;
     use DBD::ODBC;

     $DSN = "Teradata (4750:NSDW)";  # configured with ODBC Administrator

     $dbh = DBI->connect("dbi:ODBC:$DSN", "myTDname", "myTDpassword",
     {RaiseError => 1}) or die;

     $sth = $dbh->prepare("select * from dbc.databases");
     $sth->execute;

     $, = "\t";      # tab-delimited output

     print "@{$sth->{NAME}}\n";      # print the column names

     # print each row
     while ( @row = $sth->fetchrow ) {
             print "@row\n";
     }

     $sth->finish;
     $dbh->disconnect;

     1;


     
  <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