Created
October 4, 2012 10:13
(perl script)connect Access mdb database through ODBC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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