[freetds] exporting data from ODBC to mysql

Scott Antonivich scott at tpk.net
Tue May 20 10:32:09 EDT 2003


Hello,

Please bare with me as this is all new territory for me. Here is what I want
to do:

I installed freetds on a RedHat Linux 8.0 box. I am trying to connect and
export a table from a mssql7 database. Below is the script that I am using:

#!/usr/bin/perl

 use DBI;
 $ENV{'SYBASE'} = '/usr/';
 $dbh = DBI->connect('dbi:Sybase:server=XXX', 'XXX', 'XXX')
       or die 'connect';

 $dbh->do("use XXX");

 $sth = $dbh->prepare('select * from XXX') or die 'prepare';
 $sth->execute or die 'execute';

 while (@data = $sth->fetchrow_array) {
     print "$data[0] $data[1]  $data[2]\n"; # the first few fields
 }

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




My question is how do I modify the above script to get the data from a
specific table and imput it into a specific myswl database on my linux box?

Thank you for the help.


Scott




More information about the FreeTDS mailing list