ror 连接oracle时,发生错误:orc.dll找不到

按照网上连接oracle的教程

安装ruby-oci8-1.0.0-rc3-mswin32.rb

但还是发生了以下错误:


-----------------------------------------------------------------
                  Current Records                               
-----------------------------------------------------------------
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/oracle_adapter.rb:685:in `oci_connection': Oracle/OCI libraries could not be loaded: 126: 指定されたモジュールが見つかりません。   - d:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/oci8lib.so (LoadError)
 from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:262:in `send'
 from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:262:in `connection_without_query_cache='
 from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/query_cache.rb:54:in `connection='
 from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:230:in `retrieve_connection'
 from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'
 from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1139:in `add_limit!'
 from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1101:in `construct_finder_sql'
 from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:997:in `find_every'
 from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:418:in `find'
 from oracle_sample.rb:18
>Exit code: 1

继续查询发现还需要安装Oracle Instant Client 或者 Oracle Full Client,并设置好环境变量PATH, 否则找不到所需的DLL。

具体参考:http://ruby-oci8.rubyforge.org/en/InstallForInstantClient.html

database.yml的设置参考如下:

# for oracle
development:
  adapter:    oci
  host:    hostname/sid
  username: user
  password: pwd

 

你可能感兴趣的:(oracle,sql,cache,Ruby,ActiveRecord)