Ruby

Ruby Rails Oracle SuSe

yast -i ruby
yast -i rubygems
gem install rails -y

Oracle:
Download Instant Client Package – SDK and Instant Client Package – Basic (registration needed):
rpm -i oracle-instantclient-devel-11.1.0.1-1.i386.rpm
rpm -i oracle-instantclient-basic-11.1.0.1-1.i386.rpm

Download and compile ruby-oci8:
wget http://rubyforge.org/frs/download.php/22320/ruby-oci8-1.0.0-rc3.tar.gz
tar xzf ruby-oci8-1.0.0-rc3.tar.gz
cd ruby-oci8-1.0.0-rc3
export LD_LIBRARY_PATH=/usr/lib/oracle/11.1.0.1/client/lib/
make
make install

The path needs to be exported forever – for running any rails app.

If you use utf8, don’t forget to put the following to environment.rb
ENV['NLS_LANG']='AMERICAN_AMERICA.UTF8'
$KCODE = 'u'
require 'jcode'

database.yml:
adapter: oracle
database: //localhost:1521/XE

Related links: ruby-oci8, Connecting Ruby to Oracle, Rails Wiki, Ruby Oracle DBI ActiveRecord.

Leave a Reply

Your email address will not be published. Required fields are marked *