ruby connect oracle problem

59 views
Skip to first unread message

Tsolmon Narantsogt

unread,
Aug 29, 2013, 4:25:05 AM8/29/13
to rubyonra...@googlegroups.com
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.

Khizer Mehdi

unread,
Aug 29, 2013, 4:38:00 AM8/29/13
to rubyonra...@googlegroups.com
Hi Tsolmon,

Have u installed ruby-oci8 gem package

Regards
Mehdi

On 8/29/13, Tsolmon Narantsogt <mnt...@gmail.com> wrote:
> 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.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/CAPs6WSebTp9RM0CBvoQEYheXA3HkUp3%2B04Piom0FQTtDDARDKw%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

Tsolmon Narantsogt

unread,
Aug 29, 2013, 4:47:20 AM8/29/13
to rubyonra...@googlegroups.com
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




Khizer Mehdi

unread,
Aug 29, 2013, 5:31:19 AM8/29/13
to rubyonra...@googlegroups.com
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


On 8/29/13, Tsolmon Narantsogt <mnt...@gmail.com> wrote:
> 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*
> https://groups.google.com/d/msgid/rubyonrails-talk/CAPs6WSdg4N8JeJs99m5NfkYOZoUSpHb7u1NMHoRtwCGC4yUDmA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages