use DBI;
$dsn= "dbi:DriverName:database=database_name;host=hostname;port=port";
# repalce hostname in the dsn with your linux server IP and port with
the mysql port number(default is 3306)
my $dbh = DBI->connect($dsn,'USERNAME','PASSWORD') or die "Connection
Error: $DBI::errstr\n";
my $sql = "your query goes here ....";
my $sth = $dbh->prepare($sql);
$sth->execute or die "SQL Error: $DBI::errstr\n";
while (my @row = $sth->fetchrow_array) {
# Do something here ..
}
/anup
On Fri, 2009-03-13 at 06:07 -0700, gannu wrote:
> Hi All,
> I have installed DBI in xp box and I need to connect to mysql
> available in linux box. any one know how to connect and fetch the
> output of the query