使用ADO.NET提供程序(
在C中#
Data Source=1.2.3.4,1553;Initial Catalog=dbname;User Id=username;Password=pw;
为了将其转换为Perl,我尝试了以下步骤:
my $conn = Win32::SqlServer::sql_init();
$conn->setloginproperty('ConnectionString', 'Data Source=1.2.3.4,1553;Initial Catalog=dbname;User Id=username;Password=pw;');
print $conn->connect();
此外,我还尝试使用setloginproperty()分别设置服务器、登录信息和初始数据库。
这些都会在超时时间满足后失败,并显示消息:
SQL Server message 2, Severity 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [2].
Message 08001 from 'Microsoft SQL Native Client', Severity: 16
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.
Message HYT00 from 'Microsoft SQL Native Client', Severity: 16
Login timeout expired
Terminating on fatal error at mkadm.pl line 54