Ruby connect Oracle by OCI, raised loaderror

Ruby Beginner.

Code As:

require 'OCI8'
tnsnames = 'sometns'

conn = OCI8.new("usr", "pwd", tnsnames)
conn.exec('select * from sometable') do |r| 
    puts r.join(',')
end

and I’m sure I installed the oci8(latest version).
and I got

dbdoci8     oci8.rb     oci8.rb.in  oci8lib_200.so  oci8lib_210.so  oci8lib_220.so

those files in my oci libs in “/Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.1.8-x64-mingw32/lib”
Then when I run the rb file. It raised a bug info:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- oci8lib_200 (LoadError)

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.1.8-x64-mingw32/lib/oci8.rb:70:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from oracle.rb:2:in `<main>'

Thank you.


Source: ruby

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.