Steve_BZ has asked for the wisdom of the Perl Monks concerning the following question:

Hi People,

For the last three weeks I have been trying to get a connection to a Firebird Database under Kubuntu 9.04

I have a perfectly running application under Windows using ODBC, so I thought it would be easier to use that here, however, apparently not so.

Firstly Firebird

Firstly it took a good ten days to get firebird installed, because of missing dependencies and bugs in the installation. These seem to have been fixed since Kubuntu 9.10 came out last week, so I have a repeatable Firebird install.

Next ODBC

I tried unixODBC with both the odbcFb driver and the OdbcJdbc drivers, to no avail. The ODBCConfig application continually crashed when trying to create odbc.ini and odbcinst.ini files, so I built them by hand.

Although Flamerobin was connecting nicely, isql <dsn> consistently gave me

[ISQL]ERROR: Could not SQLConnect

So odbc is on hold for the time being.

DBI::Interbase

So next I tried DBI::Interbase. The CPAN install here requires a number of directories. The defaults didn't work and the install failed. So I tried searching the folder structure to pick them out by eye. The lib directory was obvious (I hope), but then it asked for the "include" directory, but there isn't one.

So this too needs more help.

So my question is: is there a very simple connection method that I can use that just involves a simple install and/or connection string?

Sorry if I am coming over as a little frustrated :{

Thanks and regards

Steve

Replies are listed 'Best First'.
Re: Getting a Perl connection to a Firebird2.1-classic database in Kubuntu 9.10
by almut (Canon) on Nov 02, 2009 at 15:32 UTC
    The lib directory was obvious (I hope), but then it asked for the "include" directory, but there isn't one.

    Maybe you need to install the associated *-dev package, which should contain the include files ?

    Include files are needed for compiling code that links against a certain library (in short, they contain the API definitions of the library, like function prototypes, constants, etc.), while they're not needed when just using an already built program.  For this reason, they are typically split out into a separate package.

Re: Getting a Perl connection to a Firebird2.1-classic database in Kubuntu 9.10
by CountZero (Bishop) on Nov 02, 2009 at 21:30 UTC
    The Makefile.PL script lists /usr/interbase/include /opt/interbase/include /opt/firebird/include /usr/include as the places it is looking for the "include" files gds.h and ibase.h if I read Makefile.PL correctly. Do you have these on your system?

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

        If Interbase won't install due to version issues, then I think trying to get ODBC working will be your best bet.

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: Getting a Perl connection to a Firebird2.1-classic database in Kubuntu 9.10
by stefbv (Priest) on Nov 02, 2009 at 17:30 UTC
    In the DBD::InterBase docs only the SuperServer architecture is mentioned in the Server section for Firebird.
Re: Getting a Perl connection to a Firebird2.1-classic database in Kubuntu 9.10
by Anonymous Monk on Nov 03, 2009 at 07:52 UTC
    I have updated the tutorial for Firebird 2.1 classic and Ubuntu Karmic koala http://www.firebirdnews.org/?p=1338
    sudo apt-get install firebird2.1-dev I have installed latest DBI wget http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.609.tar.gz tar -zxvf DBI-1.609.tar.gz cd DBI-1.609 perl Makefile.PL sudo make install Then install the Firebird driver wget http://search.cpan.org/CPAN/authors/id/E/ED/EDPRATOMO/DBD-InterBa +se-0.48.tar.gz tar -zxvf DBD-InterBase-0.48.tar.gz cd DBD-InterBase-0.48 perl Makefile.PL make make test (optional step) make install

        Hi Mariuz,

        Thanks very much for you answer, and for all the effort you went to to update the firebirdnews page. I've tried it out from a clean install, using KPackage to install firebirs2.1-classic and DBI-Perl. I still get an error (see below):

        steve@steve-desktop:~/DBI-1.609/DBD-InterBase-0.48$ perl Makefile.PL InterBase/Firebird bin directory : [/usr/bin] InterBase/Firebird include directory : [/usr/include] Multiple copies of Driver.xst found in: /usr/local/lib/perl/5.10.0/aut +o/DBI /usr/lib/perl5/auto/DBI at Makefile.PL line 92 main::locate_dbi_arch_dir() called at Makefile.PL line 333 InterBase/Firebird lib directory : [/usr/lib] Build with libfbembed? (y/n) [n] n Full path to your test database: /tmp/foo /tmp/foo does not exist. Trying to create the test database.. Please enter a username with CREATE DATABASE permission. Username : SYSDBA Password : masterkey Enter full path to isql: /usr/bin/isql-fb Use CONNECT or CREATE DATABASE to specify a database Statement failed, SQLCODE = -902 cannot attach to password database After line 0 in file ./t/create.sql Fail calling /usr/bin/isql-fb -i t/create/sql: 256 at Makefile.PL line + 295, <STDIN> line 8. # Looks like your test died before it could output anything.

        It seemed to me the isql-fb had a problem, so I tried again with a DB of my own, however this also crashed (see below).

        steve@steve-desktop:~/DBI-1.609/DBD-InterBase-0.48$ perl Makefile.PL InterBase/Firebird bin directory : [/usr/bin] InterBase/Firebird include directory : [/usr/include] Multiple copies of Driver.xst found in: /usr/local/lib/perl/5.10.0/aut +o/DBI /usr/lib/perl5/auto/DBI at Makefile.PL line 92 main::locate_dbi_arch_dir() called at Makefile.PL line 333 InterBase/Firebird lib directory : [/usr/lib] Build with libfbembed? (y/n) [n] Full path to your test database: /home/steve/Documents/endo.fdb /home/steve/Documents/endo.fdb exists. Trying to use an existing database.. Please enter a username to connect. Username : SYSDBA Password : masterkey Can't execute /usr/bin/0: No such file or directory at Makefile.PL lin +e 204, <STDIN> line 7. # Looks like your test died before it could output anything.

        Regards

        Steve

Re: Getting a Perl connection to a Firebird2.1-classic database in Kubuntu 9.10 [SOLUTION]
by Steve_BZ (Chaplain) on Nov 04, 2009 at 12:04 UTC

    Hi Guys,

    Well thank you for all your input.

    I specially want to thank 'almut' for the *-dev hint, 'CountZero' for reading through the Makfile.PL, amazing dedication to duty, and 'mapopa' for taking me down the final few yards and of course everyone else for keeping my moral up.

    OK, now the answer we've all been waiting for:

    Firebird2.1, any version, installs fairly easily on Kubuntu 9.10 with apt-get or KPackage, but you have to start the service with:

    sudo dpkg-reconfigure firebird2.1-classic

    ,which hangs but don't worry it's still done the job, or

     sudo dpkg-reconfigure firebird2.1-super

    which doesn't.

    Then you install firebird2.1-dev and DBI, again, with apt-get or KPackage. Now to get DBD::InterBase, it's the paths that throw you. Here is the script:

    wget http://search.cpan.org/CPAN/authors/id/E/ED/EDPRATOMO/DBD-InterBa +se-0.48.tar.gz tar -zxvf DBD-InterBase-0.48.tar.gz cd DBD-InterBase-0.48 perl Makefile.PL bin directory : /usr/lib/firebird/2.1/bin include directory : /usr/include lib directory : /usr/lib libfbembed? (y/n) [n] Full path to your test database: /tmp/foo/test.fdb Username : SYSDBA Password : masterkey make make test (optional step) make install

    If you haven't started the service, none of the tests will pass, in fact it still hung with me anyway, but ctrl-c is a wonderful invention.

    Finally the install worked perfectly and I'm now back to debugging.

    Thanks again for all your hard work.

    Regards

    Steve

      OK, well here's the rub. Having spent weeks getting DBD:InterBase working, it's absolutely horrible with 2.1. Acording to the doc, it's been tested with 1.5, so although it works after a fashion, it mangles dates, truncates fields and crashes doing a while/fetch. So, very disapointing. However, ODBC has mysteriously sprung into life, maybe it was the transition to Kubuntu 9.10, which seems more stable, for firebird at least. Anyway here are the ODBC instructions, which I found somewhere, I'd like to give credit, but sadly I can't remember:

      Installing the Firebird Database ODBC Driver

      The Firebird ODBC driver is not in the Ubuntu repositories so it has to be downloaded from the FirebirdSQL site: http://www.firebirdsql.org/download/prerelease/odbc/OdbcFb-LIB-RC1-2.0.0148.i686.tar.gz

      It contains a single file named "libOdbcFb.so". Copy this file to the /usr/lib directory.

      Next make sure you have the Firebird client library installed: apt-get install libfbclient2

      Openoffice and probably a few other programs will insist on using a driver named libgds.so for connecting to a Firebird database. A symbolic link will have to be created:

      nb: I didn't do this ln -s /usr/lib/libfbclient.so.2 /usr/lib/libgds.so At this point you are ready to add some entries to the odbc config files. If they don't already exist you can create them.

      Here's another example odbc.ini:

      [DBNAME] Description = Firebird Driver = Firebird Dbname = localhost:/var/lib/firebird/2.1/data/employee.fdb User = SYSDBA Password = xxxxx Role = CharacterSet = ReadOnly = No NoWait = No

      And the relevant entries for the odbcinst.ini file:

      [Firebird] Description = InterBase/Firebird ODBC Driver Driver = /usr/lib/libOdbcFb.so Setup = /usr/lib/libOdbcFbS.so Threading = 1 FileUsage = 1 CPTimeout = CPReuse =

      You should now be able to connect to DBNAME from OpenOffice or other programs using the ODBC connection method.

      Regards

      Steve

Re: Getting a Perl connection to a Firebird2.1-classic database in Kubuntu 9.10
by Anonymous Monk on Nov 03, 2009 at 07:51 UTC
    I have updated the tutorial for Firebird 2.1 classic and Ubuntu Karmic koala http://www.firebirdnews.org/?p=1338 sudo apt-get install firebird2.1-dev I have installed latest DBI wget http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.609.tar.gz tar -zxvf DBI-1.609.tar.gz cd DBI-1.609 perl Makefile.PL sudo make install Then install the Firebird driver wget http://search.cpan.org/CPAN/authors/id/E/ED/EDPRATOMO/DBD-InterBase-0.48.tar.gz tar -zxvf DBD-InterBase-0.48.tar.gz cd DBD-InterBase-0.48 perl Makefile.PL make make test (optional step) make install