2006-10-31

Perl: Read ODBC data src (Win32)

use Win32::ODBC;

$Data = new Win32::ODBC("DSN=XXX;UID=YYY;PWD=ZZZ;");
die "can't open data source: $!" unless defined($Data);

$Data->Sql("SELECT a,b FROM sometable;");

print "a;b\n";

while( $Data->FetchRow())
{
    print $Data->Data("a") . ";" . $Data->Data("b") . "\n";
}

$Data->Close();