gpt4 book ai didi

perl - Windows 10 64 位上的 Strawberry Perl Firebird 驱动程序和模块

转载 作者:行者123 更新时间:2023-12-05 03:00:11 24 4
gpt4 key购买 nike

我似乎无法编译和安装 Firebird 驱动程序以供在 Windows 10 64 位上运行的 Strawberry Perl 中使用。

我遵循的步骤包括:

  1. 下载并安装 Strawberry Perl 最新的 32 位驱动程序。

  2. 从控制台运行 cpan

  3. 在 cpan 内部使用这个安装 DBD::Firebird

  4. 模块已下载并安装,但连接到另一台 Windows 机器上的 Firebird 数据库却惨遭失败。

连接的 Perl 代码如下:

sub IB_CONNECT {
#database connection parameters
use DBI;
$dbname = 'db=192.168.0.12:c:/IXP220/Database/DB220.fdb';
$user = 'SYSDBA';
$password = 'masterkey';
$firebirdDSN='dbi:Firebird:DRIVER={Firebird};' . $dbname;
$dbhIB = DBI->connect($firebirdDSN,$user,$password);
}

有人能告诉我如何连接到这个数据库吗?

最佳答案

我通常不使用 Perl,但经过反复试验,我安装了 DBD::Firebird 并做了一个小测试,保存为 connect.pl:

use DBI;

$dbh = DBI->connect("dbi:Firebird:db=employee;host=localhost", "sysdba", "masterkey");

$sth = $dbh->prepare("SELECT country, currency FROM country");

$sth->execute();

while ( @row = $sth->fetchrow_array ) {
print "@row\n";
}

如果我没有安装 32 位的 fbclient.dll,那么 perl connect.pl 会导致错误:

install_driver(Firebird) failed: Can't load 'D:/DevSoft/Strawberry/perl/site/lib/auto/DBD/Firebird/Firebird.xs.dll' for module DBD::Firebird: load_file:The specified module could not be found at D:/DevSoft/Strawberry/perl/lib/DynaLoader.pm line 193.
at (eval 8) line 3.
Compilation failed in require at (eval 8) line 3.
Perhaps a required shared library or dll isn't installed where expected
at connect.pl line 3.

安装了 32 位 fbclient.dll 后,就可以正常工作了(结果是 Firebird 附带的 Employee 示例数据库的 COUNTRY 表):

USA Dollar
England Pound
Canada CdnDlr
Switzerland SFranc
Japan Yen
Italy Euro
France Euro
Germany Euro
Australia ADollar
Hong Kong HKDollar
Netherlands Euro
Belgium Euro
Austria Euro
Fiji FDollar
Russia Ruble
Romania RLeu

要安装 32 位 fbclient.dll,您可以执行以下操作之一:

  • 下载并运行 32 bit installer for Firebird ,并使用“最小客户端安装 - 无服务器,无工具”安装选项;
  • 如果您的机器上已经安装了 64 位 Firebird,则打开管理员命令提示符,然后转到您的 Firebird 安装的 SysWoW64 文件夹(此文件夹包含 32 位客户端库) , 并执行 instclient if;
  • 下载并解压 32 bit Firebird zip kit ,打开管理员命令提示符并转到解压压缩包的位置,然后执行 instclient if

关于perl - Windows 10 64 位上的 Strawberry Perl Firebird 驱动程序和模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57072907/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com