샘플소스를 만들어보자
#!/usr/bin/perl
use DBI;
$dsn = 'DBI:Sybase:server=admindb';
my $dbh = DBI->connect($dsn, "mssql_username", "mssql_password");
die "unable to connect to server $DBI::errstr" unless $dbh;
$dbh->do("use mssql_database");
$query = "SELECT * FROM scott";
$sth = $dbh->prepare ($query) or die "prepare failed\n";
$sth->execute( ) or die "unable to execute query $query error $DBI::errstr";
while ( @first = $sth->fetchrow_array ) {
foreach $field (@first) {
print "field: $field\n";
}
}
$dbh->disconnect;