我面临严重的限制和问题(我猜是与操作系统有关),我也在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文件,数组和地图进行一个小练习...但我的解决方案将完美地使用真正的数据库表和参照完整性...但我恐怕我将在ruby中安装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>'
答案 0 :(得分:0)
Ruby-oci8为Windows提供二进制宝石。但是,--source http://rubygems.org
传递给gem install ruby-oci8
时,它们不可用。
首先,您需要使用64位ruby才能使用64位Oracle。 请注意,最新的ruby-oci8二进制gems(版本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错误({{3} })并再次运行gem install ruby-oci8
。
答案 1 :(得分:0)
异常消息:&#34;您必须先安装开发工具&#34;您需要安装devkit。