USE Perl DBI模块 一例

1158阅读 4评论2012-05-09 fiona514
分类:Python/Ruby


点击(此处)折叠或打开

  1. #!/usr/bin/perl
  2. use DBI;
  3. my $driver="DBI:mysql";
  4. my $database="test";
  5. my $user="abc";
  6. my $host="xx.xx.xx.xx";
  7. my $pass="xxxxxx";
  8. my $port="xxxx";
  9. my $dbh=DBI->connect ("$driver:database=$database:host=$host:port=$port;user=$user;password=$pass")or die "Can't connect" . DBI->errstr;
  10. my $sth=$dbh->prepare("select xx from table where xx1=? AND xx2=?);
  11. $sth->bind_param(1,"$ARGV[0]");
  12. $sth->bind_param(2,"$ARGV[1]

上一篇:一个用Perl的Expect模块写的小脚本
下一篇:shell脚本中按日期遍历文件

文章评论