Firebird News

Tuesday, March 04, 2014

Fire Ruby - howto start with Firebird and Ruby on Ubuntu / Debian

This howto is about installing firebird ruby driver on Ubuntu (tested on natty) and Debian (tested on Sid)
you might need some firebird dependencies and if you need the stable Firebird server  Firebird 2.5 guide to install it

The very basic firebird package to build only the driver is firebird2.5-dev

sudo apt-get install firebird2.5-dev git-core
and choose yes when asked

if is already installed you will get :

firebird2.*-dev was already installed

Then you need to install ruby and rubygems , the recommended way is to use and install rvm


rvm install 2.1
rvm use 2.1

Best way is to install it from gem


gem install fb


Alternate way  is to build install our gem (latest build-able is located here )

git clone https://github.com/rowland/fb.git
cd fb/
rake gem


You will get something like this in terminal :
cd pkg/fb-0.7.0
  Successfully built RubyGem
  Name: fb
  Version: 0.7.0
  File: fb-0.7.0.gem
mv fb-0.7.0.gem ..
cd -



Now is time to install it using the gem command

gem install pkg/fb-0.*.*.gem



Please read the README.
here is how i tested on my machine


I had to add require 'rubygems'
to the example from README and all was ok after that

Here is part of the example i ran on my pc

pico test.rb 


And here are the results for my ruby test
ruby test.rb 
ID: 0, Name: John 0
ID: 9, Name: John 9

What is next class ? RoR on Firebird

11 comments:

Che said...

Hi Mariuz! I am trying to run RoR with Firebird. When I tried the little test from your blog, I get an error message:
$ ruby test.rb
/usr/local/lib/site ruby/1.8/rubygems/custom_require.rb:31:in 'gem_original_require': no such file to load -- fb (LoadError)

It seems to be a problems with PATH, but I am not sure. Please, could you help me?
Thank you very much!
Luiz (Brasilia - Brazil)

mariuz said...

did you installed the firebird gem ?

sudo gem install fb-0.6.7.gem

Vikram Kumar Mishra said...

No firebird connection established.

firebird 2.5
rails 3.2.6
ruby 1.9.2
fb 0.6.9
fb_adapter 0.6.2
activerecord-fb-adapter 0.7.0

rake db:create gives the output
{:adapter=>"fb",
:database=>"localhost/3050:/var/lib/firebird/2.5/data/rubyonfire.fdb",
:username=>"sysdba",
:password=>"12345",
:host=>"localhost",
:downcase_names=>true}
{:adapter=>"fb",
:database=>"localhost/3050:/var/lib/firebird/2.5/data/rubyonfire_test.fdb",
:username=>"sysdba",
:password=>"12345",
:host=>"localhost",
:downcase_names=>true}

please help me

Vikram Kumar Mishra said...

No firebird connection established

I am getting above error while trying to connect my rails app with firebird.

I have followed your post and in my gemfile i have added

gem 'activerecord-fb-adapter'
gem 'fb'

my rails version is 3.2.6 and ruby version is 1.9.2.

Also i have cloned 'fb' and 'fb_adapter' in rails app root directory.

Please help me.

Adrian Marius Popa said...

Try the 0.7.0 version from gem
also i have updated the repository git instructions please use the new one because there are updates for rails 3.2.x

http://rubygems.org/gems/activerecord-fb-adapter

Adrian Marius Popa said...

See this issue Try adding "create: true" under your profile in database.yml.

https://github.com/rowland/activerecord-fb-adapter/issues/1#issuecomment-6608210

Adrian Marius Popa said...

Oh a i see that you have solved that issue and hit another one :)

Vikram Kumar Mishra said...

yes, can you suggest me something on the issue posted on github regarding execute method.

Chris Valentine said...

Does anyone have this working with rails 4.0.0 or 4.0.1? I keep getting a rake aborted wrong number of arguments error on db:migrate after I create a model.

Adrian Marius Popa said...

it is solved in a fork , i will send a pull in the master today

https://github.com/Ziaw/activerecord-fb-adapter/commit/82099e7403aa6c69e543f63f79b5d97e253966af

Adrian Marius Popa said...

Also i have added another arel rails 4 update to the pull request

https://github.com/rowland/activerecord-fb-adapter/pull/13