0
我试图把这个简单的MRI脚本工作在jRuby,但我得到下面的错误。 我安装了与我的MRI相同的宝石 我不想使用JDBC的Active Record,只是做一个简单的连接和查询,我该怎么办?jRuby:使用oracle数据库
C:\jruby-1.7.4\bin>jruby -S gem list --local
给
..
ruby-oci8 (2.1.0 x86-mingw32)
..
脚本
require 'oci8'
$conn = OCI8.new('test','test','dbcm.cm_121')
sql = %q{
select * from table
}
$conn.exec(sql).fetch_hash do |r|
r.each {|key, value| puts "#{key} is #{value}"}
puts ""
end
$conn.logoff
错误
C:\jruby-1.7.4\test>jruby fetch_sql.rb
LoadError: no such file to load -- oci8lib_jruby191
require at org/jruby/RubyKernel.java:1054
require at C:/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:36
(root) at C:/jruby-1.7.4/lib/ruby/gems/shared/gems/ruby-oci8-2.1.0-x86-mingw32/lib/oci8.rb:43
require at org/jruby/RubyKernel.java:1054
(root) at C:/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:1
(root) at fetch_sql.rb:1
OCI8例子是C库..:我会使用基于Oracle JDBC驱动程序库。 – reto