Perl 数据库操作

当作偶尔练习,同时做个记录。小案例还是比较有用的。

#!/usr/bin/perl
use DBI;

#connect 
my $dbh=DBI->connect("DBI:mysql:database=db;host=localhost","root","password",{'RaiseError'=>1});
#select 
my $sth =$dbh->prepare("select * from people");
$sth->execute();

#clean up
$dbh->disconnect();

 

posted @ 2013-02-26 21:55  墨迹哥's  阅读(171)  评论(0编辑  收藏  举报