perlfirebirddbistrawberry-perl

Strawberry Perl Firebird driver and module on Windows 10 64bit


I cannot seem to get the Firebird driver compiled and installed for usage in Strawberry Perl running on Windows 10 64bit.

Steps I followed include:

  1. Download and install Strawberry Perl latest 32bit driver.

  2. run cpan from the console.

  3. Inside cpan use this install DBD::Firebird

  4. The module is downloaded and installed, however connecting to the Firebird database on another Windows machine fails miserably.

The Perl code to connect looks like:

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);
}

Please can somebody enlighten me as to how to connect to this database?


Solution

  • I don't normally use Perl, but with some trial and error I installed DBD::Firebird and made a small test saved as 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";
    }
    

    If I don't have the 32 bit fbclient.dll installed, then perl connect.pl results in an error:

    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.
    

    With the 32 bit fbclient.dll installed, then this works (result is the COUNTRY table of the Employee example database included with Firebird):

    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
    

    To install the 32 bit fbclient.dll, you can do one of the following: