Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
XP is just a number
 
PerlMonks

Getting a Perl connection to a Firebird2.1-classic database in Kubuntu 9.10

by Steve_BZ (Scribe)
 | Log in | Create a new user | The Monastery Gates | Super Search | 
 | Seekers of Perl Wisdom | Meditations | PerlMonks Discussion | 
 | Obfuscation | Reviews | Cool Uses For Perl | Perl News | Q&A | Tutorials | 
 | Poetry | Recent Threads | Newest Nodes | Donate | What's New | 

on Nov 02, 2009 at 14:59 UTC ( #804467=perlquestion: print w/ replies, xml ) Need Help??
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

Comment on Getting a Perl connection to a Firebird2.1-classic database in Kubuntu 9.10
Select or Download Code
Re: Getting a Perl connection to a Firebird2.1-classic database in Kubuntu 9.10
by almut (Abbot) 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.

[reply]
Re: Getting a Perl connection to a Firebird2.1-classic database in Kubuntu 9.10
by stefbv (Sexton) 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.
[reply]
Re: Getting a Perl connection to a Firebird2.1-classic database in Kubuntu 9.10
by CountZero (Canon) 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

[reply]
[d/l]
[select]
[reply]
        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

[reply]
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
[reply]
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
[reply]
[d/l]
[reply]

        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

[reply]
[d/l]
[select]
Re: Getting a Perl connection to a Firebird2.1-classic database in Kubuntu 9.10 [SOLUTION]
by Steve_BZ (Scribe) 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

[reply]
[d/l]
[select]
      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

[reply]
[d/l]
[select]

Back to Seekers of Perl Wisdom


Login:
Password
remember me
What's my password?
Create A New User

Node Status
node history
Node Type: perlquestion [id://804467]
Approved by Corion
Front-paged by biohisham
help
Community Ads
Chatterbox
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users
Others lurking in the Monastery: (9)
Moriarty
atcroft
herveus
ctilmes
Eyck
Gangabass
AnomalousMonk
baxy77bax
gnosti
As of 2009-11-21 11:16 GMT
Sections
The Monastery Gates
Seekers of Perl Wisdom
Meditations
PerlMonks Discussion
Categorized Q&A
Tutorials
Obfuscated Code
Perl Poetry
Cool Uses for Perl
Perl News
Information
PerlMonks FAQ
Guide to the Monastery
What's New at PerlMonks
Voting/Experience System
Tutorials
Reviews
Library
Perl FAQs
Other Info Sources
Find Nodes
Nodes You Wrote
Super Search
List Nodes By Users
Newest Nodes
Recently Active Threads
Selected Best Nodes
Best Nodes
Worst Nodes
Saints in our Book
Leftovers
The St. Larry Wall Shrine
Offering Plate
Awards
Craft
Snippets Section
Code Catacombs
Quests
Editor Requests
Buy PerlMonks Gear
PerlMonks Merchandise
Planet Perl
Perlsphere
Use Perl
Perl.com
Perl 5 Wiki
Perl Jobs
Perl Mongers
Perl Directory
Perl documentation
CPAN
Random Node
Voting Booth

Future historians will find that the material characteristic of the current era is...

Aluminium
Plastic
Oil
Water
Carbon dioxide
Copper
Iron
Silicon
Salt
Uranium
Hydrogen
Other

Results (730 votes), past polls