每当我运行 Perl 代码时,都会出现以下错误:
DBI connect('SQLSERVER','rti_dbuser',...) failed: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002) at /usr/WINAST/RTI/AGI/M_TEST.pl line 14
Coudn't Connect SQL at /usr/WINAST/RTI/AGI/M_TEST.pl line 14.
配置文件如下:
odbc.ini
[SQLSERVER]
description = Asterisk ODBC for SQL SERVER
;driver = FreeTDS
Driver = /usr/local/lib/libtdsodbc.so
server = 10.2.20.42\APSHCL
Database = RTI
port = 1433
tds_version = 9.0
try domain login = yes
try server login = yes
nt domain = DOMAIN
language = us_english
odbcinst.ini
[FreeTDS]
Description = FreeTDS ODBC driver for MSSQL
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/local/lib/libtdsS.so
FileUsage = 1
我的代码
use DBI;
use Data::Dumper;
use Asterisk::AGI;
my $agi = new Asterisk::AGI;
$first_param = $ARGV[0];
my $DSN = q/dbi:ODBC:SQLSERVER/;
my $uid = q/username/;
my $pwd = q/password/;
my $DRIVER = "Freetds";
my $dbh = DBI->connect($DSN,$uid,$pwd) or die "Coudn't Connect SQL";
my $servernumber = 2;
my $sql = "EXEC usp_check_black_list '".$first_param."'" ;
my $sth = $dbh->prepare($sql);
$sth->execute();
$return = $sth->fetchrow();
$agi->set_variable('result',$return);
print Dumper($return);
$sth->finish;
$dbh->disconnect;
每当我执行我的 perl 代码时,找不到驱动程序。我已经定义了驱动程序,但它没有使用该驱动程序....
请帮我...