<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>#!/usr/bin/perl -w<br># this PERL script will connect to a remote MySQL database and execute a select statement<br><br>use DBI; # DBI is available at CPAN.org if you don't have it installed in PERL<br><br># DBI Variables<br>my $dbh;  # database handle<br>my $sth;  # statement handle<br>my $sta;  # a statement<br>my @rows; # returned data<br>my $dbHost = "databaseHost"; # put your database host name here<br>my $dbName = "yourDatabaseName"; # put your database name here<br>my $dbUser = "DatabaseUserName"; # put your username here<br>my $dbPasswd = "databasePwd"; # put your database password here<br><br># connect to the database<br>$dbh = DBI->connect("dbi:mysql:".$dbName.":".$dbHost, $dbUser,
 $dbPwd)<br>               or die "Can't connect to database: $DBI::errstr\n\n";<br>$sta = "SELECT col1,col2 from table where item=\"1\" order by key";<br>$sth = $dbh->prepare($sta) or die "Can't prepare statment: $DBI::errstr\n\n";<br>$sth->execute or die "Can't execute statment: $DBI::errstr\n\n";<br>while (@rows = $sth->fetchrow_array() ) {<br>   print $rows[0];<br>   print $rows[1];<br>}<br><br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">De:</span></b> Franck Y <franck110@gmail.com><br><b><span style="font-weight: bold;">Para:</span></b> For users of Fedora <fedora-list@redhat.com><br><b><span style="font-weight: bold;">Enviado:</span></b>
 lunes, 13 de octubre, 2008 16:10:06<br><b><span style="font-weight: bold;">Asunto:</span></b> MSQL though a shell<br></font><br><div dir="ltr">Hello guys, <br><br>I have to query a remote database that run under MSQL and get the result within a shell/perl script ?<br><br>Does anyone of you did that ? I would not like to purchase a ODBC driver since it is for a project at school <br>
<br>Thanks<br><br>Franck<br>
</div>
</div></div></div><br>



      <hr size=1><br><font face="Verdana" size="-2">¡Todo sobre Amor y Sexo!<br>La guía completa para tu vida en Mujer de Hoy:<br>
http://mx.mujer.yahoo.com/</font></body></html>