Skip to content

ruby on rails (2.0.1, 2.0.2) and oracle on FC8

Get the following rpm’s from oracle

  • oracle-instantclient-basic-10.2.0.3-1.i386.rpm
  • oracle-instantclient-devel-10.2.0.3-1.i386.rpm

(Note: this should work fine with the newer versions as well)

As root

cd PATH_TO_RPMS
rpm -ivh oracle-instantclient-basic-10.2.0.3-1.i386.rpm oracle-instantclient-devel-10.2.0.3-1.i386.rpm
echo /usr/lib/oracle/10.2.0.3/client/lib/ > /etc/ld.so.conf.d/oracle-instant-client-i386.conf

This last step, the echo, is a bit of magic. The conf files in /etc/ld.so.conf.d are run before each command is invoked to set your library path. The enviroment variable $LD_LIBRARY_PATH overrides these. You won’t see the contents of these files in your $LD_LIBRARY_PATH, but the application will. If your distribution doesn’t have an /etc/ld.so.conf.d directory, you can just add /usr/lib/oracle/10.2.0.3/client/lib to your LD_LIBRARY_PATH inthe /etc/profile, ~/.bash_profile, or any of the other more common places.

Now you need to find the latest ruby-oci8, check http://ar.rubyonrails.com/ and put it in /usr/local/src/

wget http://rubyforge.org/frs/download.php/36134/ruby-oci8-1.0.1.tar.gz
tar -xzvf ruby-oci8-1.0.1.tar.gz
cd ruby-oci8-1.0.1
ruby setup.rb config
make
make install

The previous versions of oci8 and ora instant clients required that you make several symlinks, and was a pain to set up. With the current oci8 and the instant clients on your LD_LIBRARY_PATH, the compile and install should work just fine.

With rails 2.1 out, the activerecord-oracle-adapter is no longer hosted on gems.rubyonrails.org. You can see this with a “gem list -r –source http://gems.rubyonrails.org”. So you have to do the ugly method of directly grabbing the adapter yourself. It is very easy though:

wget -P /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/  http://svn.rubyonrails.org/rails/adapters/oracle/lib/active_record/connection_adapters/oracle_adapter.rb

That’s it. Just remember to make sure that you grab the right versions of everything.

10 Comments