问题
After successfully installing the ruby-0ci8 gem and the oracle_enhanced adapter gem I get the following error when I try to fire up my rails project server:
=> Booting WEBrick
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Library/Ruby/Gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.3.2/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb:7:
ERROR: ActiveRecord oracle_enhanced adapter could not load ruby-oci8 library.
Please install ruby-oci8 gem. (LoadError)
Both the enhanded adapter and ruby-oci8 gem show up in my gem list. Both are present in my Gemfile. Why can't the adapter find the oci8 library?
Some specs on setup I'm running:
- Mac Snow Leopard (10.6.8)
- Ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.8.0]
- Rails 3.0.3
- ruby-oci8 (2.0.4) [gem]
- activerecord-oracle_enhanced-adapter (1.3.2) [gem]
I've looked at this post: Rails 3.0.3 - Oracle_enhanced doesn't work. But it's not helping. Anyone else run into this?
==============================
Answer
I got it figured out. In the end i had an incorrect file structure in /usr/local/oracle/instantclient_10_2/ where I had stored the files for my oracle instant client. That is what was causing all the issues. Basically I had nested a second instantclient_10_2 directory inside the first and I had my .bash_profile looking in the first directory and not the one below it.
回答1:
Run sudo apt-get install libaio1
回答2:
-Basically, I added the following 2 lines to the Gemfile:
gem 'ruby-oci8', '~> 2.0.6'
gem 'activerecord-oracle_enhanced-adapter', '~>1.4.0'
-then ran the following on command line:
bundle install
-make sure you don't have other versions of ruby-oci8 or activerecord-oracle_enhanced-adapter in the Gemfile
-For the regular oracle active record adapter I added these lines instead:
gem 'ruby-oci8', '~> 1.0.4'
gem 'activerecord-oracle-adapter', '~>1.0.0.9250'
-then ran the following on command line:
bundle install
I got the solution from: Rails 3.0.3 - Oracle_enhanced doesn't work
回答3:
This issue is noted on the gems list of platform specific issues. Your most likely solution is to follow the guide provided on how to set up the Oracle Instant Client.
来源:https://stackoverflow.com/questions/7016937/activerecord-oracle-enhanced-adapter-cant-load-ruby-oci8-library