Search code examples
rubyoracle-databasesequel

Issue regarding the connection between ruby and oracle database using sequel gem


I am using sequel gem to connect and access my oracle database using a ruby program.

I have installed sequel gem and oracle instant client both. I have also installed ruby-oci8 gem. But still getting this error as follows:-

Loaderror: cannot load such file -- oci8 (Sequel::AdapterNotFound)

My code is :-

require 'sequel'
DB = Sequel.connect('oracle://localhost/XE', :user=>'SYSTEM', :password=>'tiger')

DB['select  NAME from EMPLOYEE'].each do |row|
  puts row
end

Please help me to fix this. I don't even know that what would be the right form of this line

Sequel.connect('oracle://localhost/XE', :user=>'SYSTEM', :password=>'tiger')

My database name is XE, user is SYSTEM and password is tiger.


Solution

  • The LoadError indicates you don't have the oci8 gem installed. You can probably fix it using: gem install oci8