我有一个脚本,我在其中连接到数据库并尝试执行 sql 查询。我的代码是这样的
use DBI;
$dbh = DBI->connect('Databasename', 'uid','pswd');
my $sth = $dbh->prepare ("select * from Tablename");
$sth->execute();
my @row_ary = $sth->hetshrow_array;
foreach $item (@row_ary)
{
print "$item\n";
}
当我尝试执行此代码时,我收到以下错误消息
Can't connect to data source 'Databasename' because I can't work out what driver to use (it doesn't seem to contain a 'dbi:driver:' prefix and the DBI_DRIVER env var is not set) at demo.pl line 2
任何人都可以建议我为什么收到此消息。执行 sql 查询需要做哪些配置。
谢谢