X

Katsumi's Blog

Ruby: OCI based driver worked in Cygwin!

As I wrote yesterday, I installed Ruby on Windows7 on bash prompt.
Today, I installed "Oracle database access driver for Ruby" on command line again.

kubo/ruby-oci8

Ruby-oci8 is a ruby interface for Oracle Database.

For most Windows users, I think remote 'gem' install would work just fine.
But since I tried Cygwin version and I even use non-standard mount option,
I needed to tweak a single word in ruby code. I hope I can contribute a patch some day.

# gem install ruby-oci8 --remote
Building native extensions. This could take a while...
ERROR: Error installing ruby-oci8:
[...]
Results logged to /c/c/Users/katinoue/.gem/ruby/extensions/x86_64-cygwin/ruby-oci8-2.2.1/gem_make.out
# tail -1 ~/.gem/ruby/extensions/x86_64-cygwin/ruby-oci8-2.2.1/*.log
sh: /cygdrive/C/OracleATS/oxe/app/oracle/product/11.2.0/server/bin/sqlplus: No such file or directory
# dir /cygdrive
ls: cannot access /cygdrive: No such file or directory
# grep cygdrive /etc/fstab
none /c cygdrive binary,posix=0,user 0 0
# git clone https://github.com/kubo/ruby-oci8
Cloning into 'ruby-oci8'...
# cd ruby-oci8/
# sed -i.backup '916s/cygdrive/c/' ext/oci8/oraconf.rb
# gem build ruby-oci8.gemspec
Successfully built RubyGem
Name: ruby-oci8
Version: 2.2.1
File: ruby-oci8-2.2.1.gem
# gem install ruby-oci8 --local
Building native extensions. This could take a while...
Successfully installed ruby-oci8-2.2.1
Parsing documentation for ruby-oci8-2.2.1
Done installing documentation for ruby-oci8 after 3 seconds
1 gem installed
$ ruby -r oci8 -e "OCI8.new('hr','hr','localhost/xe').exec('select * from translation where rownum<5') \
> do |r| puts r.join(','); end"
自動ワークロードレポジトリ,AWR
開発,Development
ロードバランス,Load Balance
技術,Technical

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.