Skip to content

Instantly share code, notes, and snippets.

@cofearabi
Created October 4, 2012 10:13
Show Gist options
  • Save cofearabi/3832720 to your computer and use it in GitHub Desktop.
Save cofearabi/3832720 to your computer and use it in GitHub Desktop.
(perl script)connect Access mdb database through ODBC
#!/usr/local/bin/perl
use Win32::ODBC;
print "Content-type: text/html\n\n";
print "<html>";
print "<body>";
$db= new Win32::ODBC("DSN=passwd");
$db->Sql("SELECT * FROM password");
# 取得したレコードセットの数だけループして表示
while ( $db->FetchRow() ){
undef %FIELDS;
# 各フィールドのデータをハッシュに格納
%FIELDS= $db->DataHash();
print "$FIELDS{'password'} $FIELDS{'keyword'}<BR>\n";
}
# データベースを閉じる
$db->Close( );
print "</body></html>";
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment