ruby connect oracle problem

Hello folks.

I’m new in Ruby also ROR.

I installed oracle intant client and test it it works fine. Now I wanna connect to oracle db. But its got some error. like this

custom_require.rb:36:in `require’: cannot load such file – oci8 (LoadError)

my code is here.

require ‘oci8’ oci = OCI8.new(‘user’,‘pass’,‘ip:port/sid’)

oci.exec(‘select * from table’) do |record| puts record.join(‘,’) end

Pls help me. What’s wrong ?

Regards.

Hi Tsolmon,

     Have u installed ruby-oci8 gem package

Regards Mehdi

Yes i installed ruby-oci8 from source.

like this linux: ruby setup.rb config – --with-instant-client

then mnts26@mnts26:~/Downloads/ROR OCI8/ruby-oci8-2.0.4$ make

ruby -w setup.rb config setup.rb:278: warning: assigned but unused variable - vname setup.rb:278: warning: assigned but unused variable - desc setup.rb:278: warning: assigned but unused variable - default2 setup.rb:109: Use RbConfig instead of obsolete and deprecated Config.

—> lib —> lib/dbd <— lib/dbd —> lib/oci8 <— lib/oci8 <— lib —> ext —> ext/oci8 /home/mnts26/.rvm/rubies/ruby-1.9.3-p448/bin/ruby /home/mnts26/Downloads/ROR OCI8/ruby-oci8-2.0.4/ext/oci8/extconf.rb

setup.rb:476: warning: Insecure world writable dir /opt/oracle in PATH, mode 040777 /home/mnts26/.rvm/rubies/ruby-1.9.3-p448/bin/ruby: No such file or directory – /home/mnts26/Downloads/ROR (LoadError) 'system /home/mnts26/.rvm/rubies/ruby-1.9.3-p448/bin/ruby /home/mnts26/Downloads/ROR OCI8/ruby-oci8-2.0.4/ext/oci8/extconf.rb ’ failed

Try ‘ruby setup.rb --help’ for detailed usage. make: *** [config.save] Error 1

I got those lines.

Regards

Installation failed due to error

For installing that ruby-oci8 gem u need 1. instantclient-basic 2. instantclient-sdk 3. u need to export LD_LIBRARY_PATH of that path 4. then run bundle install

Regards Mehdi