# Connecting to Oracle from Rails 2.0.2

**URL:** <https://www.ruby-forum.com/t/connecting-to-oracle-from-rails-2-0-2/129954>\
**Category:** Rails\
**Created:** [February 22, 2008, 11:59pm UTC](https://www.ruby-forum.com/t/connecting-to-oracle-from-rails-2-0-2/129954 "2008-02-22T23:59:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![silviogalea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@silviogalea](https://www.ruby-forum.com/u/silviogalea)\
**Post date:** [February 22, 2008, 11:59pm UTC](https://www.ruby-forum.com/t/connecting-to-oracle-from-rails-2-0-2/129954/1 "2008-02-22T23:59:36Z")

</div>

Long afternoon, but finally got it. Hope this spares you some pain:

Installation instructions mainly based on:  
[http://ruby.about.com/od/enterprise/ss/ruby\_oracle.htm](http://ruby.about.com/od/enterprise/ss/ruby_oracle.htm)

Install Oracle Instant Client:  
mkdir C:\oracle  
cd c:\oracle  
Get the following files from here:  
[http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html](http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html)  
and unzip them into the c:\oracle  
unzip instantclient-basic-OS-VERSION.zip  
unzip instantclient-sdk-OS-VERSION.zip  
unzip instantclient-sqlplus-win32-11.1.0.6.0.zip

Append the following value to your system path:  
C:\oracle\instantclient\_11\_1

Download the following file: [http://rubyforge.org/frs/?group\_id=256](http://rubyforge.org/frs/?group_id=256)  
Run the following from the command prompt: c:\where you saved file\>“ruby  
ruby-oci8-1.0.0-mswin32.rb”  
Answer “Yes”

Assuming that you have previously installed rails 1.x, copy the oracle  
adapters manually from:  
C:\ruby\lib\ruby\gems\1.8\gems\activerecord-2.0.2\lib\active\_record\connection\_adapters\oracle\_adapter.rb  
to:

C:\ruby\lib\ruby\gems\1.8\gems\activerecord-1.15.6\lib\active\_record\connection\_adapters  
and rename it to oci\_adapter.rb

Copy the ora.dll & oraociei11.dll from C:\oracle\instantclient\_11\_1 to  
c:\ruby\bin

Edit your database.yml to read:

development:  
adapter: oci  
host: :/  
username:   
password:

go to [http://localhost:3000](http://localhost:3000)  
expand “About your application’s environment”  
the Database adapter should read: oci

good luck. Next up, trying to get this to work on OSX & Linux. weee,  
the fun!

---

<div class="post-metadata">

**Author:** ![silviogalea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@silviogalea](https://www.ruby-forum.com/u/silviogalea)\
**Post date:** [February 23, 2008, 12:12am UTC](https://www.ruby-forum.com/t/connecting-to-oracle-from-rails-2-0-2/129954/2 "2008-02-23T00:12:16Z")

</div>

Silvio Galea wrote:

> Assuming that you have previously installed rails 1.x, copy the oracle  
> adapters manually from:  
> C:\ruby\lib\ruby\gems\1.8\gems\activerecord-2.0.2\lib\active\_record\connection\_adapters\oracle\_adapter.rb  
> to:
> 
> C:\ruby\lib\ruby\gems\1.8\gems\activerecord-1.15.6\lib\active\_record\connection\_adapters  
> and rename it to oci\_adapter.rb

Alternatively, get the new adapter for Rails 2:  
[http://gems.rubyonrails.org/gems/activerecord-oracle-adapter-1.0.0.gem](http://gems.rubyonrails.org/gems/activerecord-oracle-adapter-1.0.0.gem)  
Then run:  
gem install activerecord-oracle-adapter -l

and use “oracle” as the adapter…

---

<div class="post-metadata">

**Author:** ![silviogalea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@silviogalea](https://www.ruby-forum.com/u/silviogalea)\
**Post date:** [February 25, 2008, 3:38am UTC](https://www.ruby-forum.com/t/connecting-to-oracle-from-rails-2-0-2/129954/3 "2008-02-25T03:38:54Z")

</div>

More convenient way to install the Oracle adapter :  
gem install activerecord-oracle-adapter --source  
[http://gems.rubyonrails.org](http://gems.rubyonrails.org)

or check it out from svn:  
svn co  
[http://svn.rubyonrails.org/rails/adapters/oracle/lib/active\_record/connection\_adapters/](http://svn.rubyonrails.org/rails/adapters/oracle/lib/active_record/connection_adapters/)

since Rails 2.0 will not ship with Oracle adapter.

2008/2/23, Mark B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 1.15.6\lib\active\_record\connection\_adapters  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Cheers,  
Jesse
