sql-server - Perl 脚本无法使用 ODBC 连接到 MS SQL:“连接字符串无效”
问题描述
脚本 test.pl
use DBI;
$dbh = DBI->connect(
"dbi:ODBC:" .
"Driver={/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.5.so.2.1};" .
"Server=10.3.0.241;" .
"Database=TEST;" .
"UID=test;" .
"PWD=test123"
);
结果
DBI connect('Driver={/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.5.so.2.1};Server=10.3.0.241,0;Database=TEST;UID=test;PWD=test123','',...) failed: [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (SQL-HYT00) [state was HYT00 now 08001]
[Microsoft][ODBC Driver 17 for SQL Server]MAX_PROVS: Connection string is not valid [87]. (SQL-08001)
[Microsoft][ODBC Driver 17 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. (SQL-08001) at ./test.pl line 6.
服务器老板说:你连接不上1433端口,我们用的是SSMS,端口会自动连接
解决方案
服务器=10.3.0.241;变成服务器=10.3.0.241\MSSQL;
然后我的 linux 可以通过 udp/1443 与 windows 服务器通信,并相互了解在哪个 tcp 端口上继续通信。
推荐阅读
- batch-file - 如何在执行程序之前修复添加“1”的批处理
- java - 如何将值附加到elasticsearch java api中的数组
- character-encoding - MockMvc:将 MockHttpServletResponse 的默认字符编码从 ISO-8859-1 更改为 UTF-8
- oauth-2.0 - 如何使用适用于电视和受限输入设备应用程序的 OAuth 2.0 访问 Google Drive 视频和图像?
- c - 如何将文件映射到 /dev/zero
- angular - 如何显示消息时是空的,有角度并且有一个过滤器?
- python - 如何检测具有至少 1 个共同元素的共同元素列表和分组列表?
- html - Bootstrap 4在div的绝对中心对齐标签
- javascript - 用于wordpress网站的.htaccess中的Html按钮onclick重定向
- javascript - All possible words of any length from the input letters, javascript