How do I connect to a MSSQL database using Perl#39;s DBI module in Windows?(如何在 Windows 中使用 Perl 的 DBI 模块连接到 MSSQL 数据库?)
问题描述
如何在 Windows 中使用 Perl 的 DBI 模块连接到 MSSQL 数据库?
How do I connect to a MSSQL database using Perl's DBI module in Windows?
推荐答案
使用 DBD::ODBC.如果您只是使用控制面板 -> 系统管理 -> ODBC 数据源 -> 系统数据源或用户数据源创建数据源(这些是我记得的名称,但我的 XP 不是英文的,所以我无法检查),那么您所要做的就是在 DBI 连接字符串中使用该数据源的名称.
Use DBD::ODBC. If you just create a data source with the Control Panel -> System Management -> ODBC Data Sources -> System Data Source or User Data Source (those are the names as I remember them, but my XP isn't in English, so I can't check), then all you have to do is use the name of that data source in the DBI connect string.
my $dbh = DBI->connect("dbi:ODBC:$dsn", $user, $pwd, \%attr);
用户和系统数据源之间的区别在于后者可供任何用户使用.
The difference between User and System data source is that the latter is usable by any user.
另见:如何:在 Windows XP 中创建系统数据源名称
这篇关于如何在 Windows 中使用 Perl 的 DBI 模块连接到 MSSQL 数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 Windows 中使用 Perl 的 DBI 模块连接到 MSSQL 数据库?


基础教程推荐
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01