views:

85

answers:

1

So, following a variety of tutorials, I installed the following gems on my windows box:

"activerecord-oracle_enhanced-adapter"

and

"ruby-oci8"

As well as modifying my database.yml to look like:

oracle_development:
  adapter: oracle_enhanced
  database: 127.0.0.0:1521/sid
  username: uid
  password: pid

Ruby OCI8 wouldn't compile (the tutorial at: [the rails wiki][1] implied this might be the case, and suggested using version 1.0.4, instead). So, 1.0.4 compiles and installs just fine, but once I have it (and load a oci.dll into Ruby), I run a quick test from the Rails Console and see:

Loading development environment (Rails 2.3.5)

OracleConnector.test RuntimeError: Please install the oracle_enhanced adapter: gem install activerec ord-oracle_enhanced-adapter (ERROR: ruby-oci8 version 1.0.7 is too old. Please install ruby-oci8 version 2.0.3 or later.)

I'm not really sure what to do. For one, I DEFINITELY have the "activerecord-oracle_enhanced-adapter", and I'm not sure why it thinks other wise. For two, I have no idea how to get a newer copy of OCI8...when I try, I see:

C:\Documents and Settings\jschultz\workspace\OracleTest>gem install ruby-oci8
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-oci8:
        ERROR: Failed to build gem native extension.

C:/Ruby/bin/ruby.exe extconf.rb
checking for load library path...
  PATH...
    checking C:\Ruby\bin... yes
  C:/Ruby/bin/oci.dll looks like a full client.
checking for cc... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby/bin/ruby
        --with-instant-client
        --without-instant-client
./oraconf.rb:562:in `check_cc': RuntimeError (RuntimeError)
        from ./oraconf.rb:549:in `init'
        from ./oraconf.rb:680:in `initialize'
        from ./oraconf.rb:345:in `new'
        from ./oraconf.rb:345:in `get'
        from extconf.rb:18
ng
---------------------------------------------------
Error Message:
  C compiler doesn't work correctly.
Backtrace:
  ./oraconf.rb:562:in `check_cc'
  ./oraconf.rb:549:in `init'
  ./oraconf.rb:680:in `initialize'
  ./oraconf.rb:345:in `new'
  ./oraconf.rb:345:in `get'
  extconf.rb:18
---------------------------------------------------
See:
 * http://ruby-oci8.rubyforge.org/en/HowToInstall.html
 * http://ruby-oci8.rubyforge.org/en/ReportInstallProblem.html




  [1]: http://wiki.rubyonrails.org/database-support/oracle

And I have NO idea what to do about that...

A: 

Hi there, for starters you should be using the correct ruby version. Use version 1.8.7 or 1.9.1 from rubyinstaller.org. Then make sure to install the development kit.

Once you have that, you can just run gem install ruby-oci8 and it will work. The development kit will allow to make native builds.

nathanvda
Umm.. I don't suppose you would know why updating rails fixed the gem problem...but made it so rails doesn't work at all?http://stackoverflow.com/questions/3407428/upgrading-ruby-broke-rails
Jenny
Hi Jenny, i added an answer to that question too. Actually it is logical, albeit a bit counter-intuitive at first: each ruby version has its own folder and its own set of gems, so you will have to re-install rails and all gems you need.
nathanvda