我有一个perl脚本使用这个脚本连接sqlserver数据库并在这种情况下执行存储过程perl scrip会出现一个错误 是
use DBI;
my $host = 'server';
my $database = 'db';
my $user = 'usr';
my $auth = 'pssword';
# DBD::ADO
$dsn = "Provider=sqloledb;Trusted Connection=yes;";
$dsn .= "Server=$host;Database=$database";
my $dbh = DBI->connect("dbi:ADO:$dsn",
$user,
$auth,
{ RaiseError => 1, AutoCommit => 1}
) || die "Database connection not made: $DBI::errstr";
my $sql = "EXEC [dbo].[get_status] '2013-10-31','00',320,'MBM40CASHFLW'";
my $sth = $dbh->prepare($sql);
$sth->execute();
$sth->finish();
$dbh->disconnect();
上面的脚本我使用dbi:ado驱动程序。我在此存储过程中提供了完全的高级权限
错误是
DBD::ADO::st execute failed: Can't execute statement 'EXEC [dbo].[sap.get_status_load_data] '2013-10-31','00!',320,'MBMY_FCL_S40CASHFLW''
Lasterror: -2147217871: OLE exception from "Microsoft OLE DB Provider for SQL Server":
Query timeout expired
Win32::OLE(0.1709) error 0x80040e31
in METHOD/PROPERTYGET "Execute"
Description: Query timeout expired
HelpContext: 0
HelpFile:
NativeError: 0
Number: -2147217871
Source: Microsoft OLE DB Provider for SQL Server
SQLState: HYT00 at C:\Users\Administrator\Desktop\temp\testdbconn.pl line 19.
请帮助我.....
答案 0 :(得分:1)
您是否尝试过设置超时属性?也许:
{ RaiseError => 1, AutoCommit => 1, ado_ConnectionTimeout => 300, CommandTimeout => 300}
(取决于您当前的超时时间)。