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

Strawberry Perl Firebird driver and module on Windows 10 64bit

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

我遵循的步骤包括:

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

  2. 运行 cpan 来自控制台。

  3. 在 cpan 内部使用这个 install 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 附带的员工示例数据库的 COUNTRY table):

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,并使用 'Minimum client install - no server, no tools' 安装选项;
  • 如果您的计算机上已经安装了 64 位 Firebird,则打开管理员命令提示符,然后转到 Firebird 安装的 SysWoW64 文件夹(此文件夹包含 32 位客户端库),并执行 instclient i f;
  • 下载并解压 32 bit Firebird zip kit,打开管理员命令提示符并转到解压压缩包的位置,然后执行 instclient i f