Friday, November 14, 2008

Connecting rails application with oracle 8i

1. Install Oracle Instant ClientDownloaded the Instant Client packages for free from Oracle.
All I needed are these two from Version 10.2:
->Instant Client Package - Basicinstantclient-basic-linux-x86-64-10.2.0.3-20070103.zip (36 MB)
->Instant Client Package - SDKinstantclient-sdk-linux-x86-64-10.2.0.3-20070103.zip (0.6 MB)I had downloaded the files into /opt/oracle.
# mkdir /opt/oracle
# cd /opt/oracle
# unzip /proj/downloads/instantclient-basic-linux-x86-64-10.2.0.3-20070103.zip
# unzip /proj/downloads/instantclient-sdk-linux-x86-64-10.2.0.3-20070103.zip
# cd instantclient_10_2
Then create the following symbolic link
# ln -s libclntsh.so.10.1 libclntsh.so
Edit /etc/bashrc to include the directory in your LD_LIBRARY_PATH environment variable by adding these linesLD_LIBRARY_PATH=/opt/oracle/instantclient_10_2:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

2. Install ruby-oci8Download version 1 of the interface from rubyforge:
# wget http://rubyforge.org/frs/download.php/16630/ruby-oci8-1.0.0-rc1.tar.gz
Unpack, make and install the package# tar -zxvf ruby-oci8-1.0.0-rc1.tar.gz
# cd ruby-oci8-1.0.0-rc1
# make
# make install
The make calls ruby setup.rb to configure and then compile the code.
It should all go smoothly provided the Oracle libraries are in place and it knows where to find them.

3. configuring database.yml file of rails application.

I connected to dev database in the host one.cisco.com
development:
adapter: oci
host: one.cisco.com/dev
username:
password:

Note : Note : In /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active-record/connection-adapters , change oracle_adapter.rb to oci_adapter.rb
#cp oracle_adapter.rb oci_adapter.rb

About Me

Friendly and humanitarian Honest and loyal Original and inventive Independent and intellectual