繁体   English   中英

RUBY:无法在Ruby 2.1.5p273(Windows 8.1)上安装0ci8库并连接到Oralce

[英]RUBY: Unable to install 0ci8 library on Ruby 2.1.5p273 (windows 8.1) and connect to Oralce

我面临严重的限制和问题(我猜是与操作系统有关),我已经在Ruby的一个中查看了很多论坛,但并没有真正给予他们很大的帮助; 我真的认为社区没有真正的支持或API /库可用性。

细节:

Ruby版本:2.1.5p273

Ruby路径:C:\\ Ruby21 \\ bin

宝石版:2.2.2

操作系统:Windows 8.1 64位

ORACLE版本:Oracle Database 12c企业版12.1.0.1.0版 - 64位生产版

Oracle:D:\\ app \\ username \\ product \\ 12.1.0 \\ dbhome_1

在CMD

gem install ruby-oci8  --source http://rubygems.org

但很多错误:

checking for load library path...
  PATH...
    checking D:\app\Usern\product\12.1.0\dbhome_1\bin...   skip: D:/app/Usern/product/12.1.0/dbhome_1/bin/oci.dll is for x86_64 cpu.
    checking C:\app\Username\product\12.1.0\dbhome_3\bin... no
    checking C:\app\Username\product\12.1.0\dbhome_2\bin... no
    checking C:\app\Username\product\12.1.0\dbhome_1\bin... no
    checking C:\Program Files (x86)\Intel\iCLS Client\... no
    checking C:\Program Files\Intel\iCLS Client\... no
    checking C:\WINDOWS\system32... no
    checking C:\WINDOWS... no
    checking C:\WINDOWS\System32\Wbem... no
    checking C:\WINDOWS\System32\WindowsPowerShell\v1.0\... no
    checking C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86... no
    checking C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64... no
    checking C:\Program Files\Intel\Intel(R) Management Engine Components\DAL... no
    checking C:\Program Files\Intel\Intel(R) Management Engine Components\IPT... no
    checking C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL... no
    checking C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT... no
    checking C:\Users\Username\AppData\Local\Smartbar\Application\... no
    checking C:\Users\Username\AppData\Local\Smartbar\Application\... no
    checking D:\Strawberry\c\bin... no
    checking D:\Strawberry\perl\site\bin... no
    checking D:\Strawberry\perl\bin... no
    checking C:\php... no
    checking C:\\bin... no
    checking C:\scala\bin... no
    checking C:\Ruby21\bin... no
    checking C:\Program Files (x86)\Java\jdk1.7.0_40\bin... no
checking for cc... ---------------------------------------------------
Error Message:
  The compiler failed to generate an executable file.
  You have to install development tools first.

    Error Message:
      The compiler failed to generate an executable file.
      You have to install development tools first.

Backtrace:
  C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:456:in `try_do'
  C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
  C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:840:in `try_run'
  C:/Ruby21/ruby-oci8-2.1.7/ext/oci8/oraconf.rb:566:in `check_cc'
  C:/Ruby21/ruby-oci8-2.1.7/ext/oci8/oraconf.rb:556:in `init'
  C:/Ruby21/ruby-oci8-2.1.7/ext/oci8/oraconf.rb:705:in `initialize'
  C:/Ruby21/ruby-oci8-2.1.7/ext/oci8/oraconf.rb:320:in `new'
  C:/Ruby21/ruby-oci8-2.1.7/ext/oci8/oraconf.rb:320:in `get'
  C:/Ruby21/ruby-oci8-2.1.7/ext/oci8/extconf.rb:18:in `<main>'
---------------------------------------------------
See:
 * http://rubydoc.info/gems/ruby-oci8/file/docs/install-full-client.md for Oracle full client
 * http://rubydoc.info/gems/ruby-oci8/file/docs/install-instant-client.md for Oracle instant client
 * http://ruby-oci8.rubyforge.org/en/file.report-installation-issue.html to report an issue.

*** C:/Ruby21/ruby-oci8-2.1.7/ext/oci8/extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

为什么我需要这个?

我正在使用CSV文件,数组和地图进行一个小练习......但我的解决方案将完美地使用真正的数据库表和参照完整性...但我担心我将在红宝石中安装oci8:

我展示了一个失败的代码示例

require 'oci8'


#sqlplus fred/fred@localhost:1521/DB1


oci = OCI8.new('fred','fred','localhost:1521/DB1')
oci.exec('select sysdate from dual') do |record|
  puts record
end


ERROR in Eclipse Luna:

C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- oci8 (LoadError)
    from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from C:/Users/Username/db.rb:1:in `<main>'

Ruby-oci8为Windows提供二进制gem。 但是当--source http://rubygems.org传递给gem install ruby-oci8时,它们不可用。

首先,您需要使用64位ruby才能使用64位Oracle。 请注意,最新的ruby-oci8二进制gem(版本2.1.7)不捆绑ruby 2.2.1的扩展库。 你应该使用ruby 2.1.5(x64)

辅助,如果你得到一个错误,如SSL_connect returned=1 errno=0 state=SSLv3 ...当你运行gem install ruby-oci8没有 --source http://rubygems.org )时,修复SSL错误( https ://gist.github.com/luislavena/f064211759ee0f806c88 )并再次运行gem install ruby-oci8

异常消息:“您必须先安装开发工具”您需要安装devkit

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM