1条回答
默认
最新
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
墨值悬赏
匿名用户Perl脚本怎么连接OB 麻烦提供下例子代码 谢谢
#!/usr/bin/perl -w
use strict;
use DBI;
my $host = “localhost”;
my $driver = “mysql”;
my $database = “RUNOOB”;
my $dsn = “DBI:$driver:database=$database:$host”;
my $userid = “root”;
my $password = “123456”;
连接数据库
my $dbh = DBI->connect($dsn, $userid, $password ) or die $DBI::errstr;
my $sth = $dbh->prepare(“SELECT * FROM Websites”);
$sth->execute();
while ( my @row = $sth->fetchrow_array() )
{
print join(’\t’, @row)."\n";
}
$sth->finish();
$dbh->disconnect();
评论
有用 0
墨值悬赏