Connecting to Oracle from Rails 2.0.2

22 views
Skip to first unread message

Silvio Galea

unread,
Feb 22, 2008, 5:59:36 PM2/22/08
to rubyonra...@googlegroups.com
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

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
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
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: <your db host>:<your db port>/<your db sid>
username: <uid>
password: <pwd>

go to 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!
--
Posted via http://www.ruby-forum.com/.

Mark Bush

unread,
Feb 22, 2008, 6:12:16 PM2/22/08
to rubyonra...@googlegroups.com
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
Then run:
gem install activerecord-oracle-adapter -l

and use "oracle" as the adapter...

Jesse Hu

unread,
Feb 24, 2008, 9:37:49 PM2/24/08
to rubyonra...@googlegroups.com
More convenient way to install the Oracle adapter  :
    gem install activerecord-oracle-adapter --source http://gems.rubyonrails.org
or check it out from svn:
    svn co 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 Bush <rails-mai...@andreas-s.net>:
Reply all
Reply to author
Forward
0 new messages