Undefined method 'define_a_column' for class 'OCI8::Cursor'


#1

Hello. Tired of searching and finding nothing useful.

Moving application to laptop for trip.

Installed:

  • Ruby (1.8.6, patchlevel 111)
  • Rails (2.2.2)
  • Oracle adapter (1.0.0.9250)
  • ruby-oci8 (2.0.1)
  • Oracle 10g Express Edition

database.yml:
development:
adapter: oracle
etc…

When I start Mongrel (ruby script/server) I get the error above. I’ve
looked everywhere I can think of. Any ideas what might be happening?

Thanks a lot.

Pepe


#2

Never mind.

I installed oci8 as a gem and it seemed not to like it. I uninstalled
the gem and then donwloaded the version that needs to be installed by
running a ruby program and now everything is happy.

Sorry for the interruption.

Pepe


#3

I had this same issue so in the interest of shortening someone else’s
search I thought I’d document it a little more.

The problem I was having (and I assume pepe) was that the OCI8::Cursor
interface has changed between 1.0.x and 2.0.x. The rails oracle support
(activerecord-oracle-adapter gem) uses 1.0.x. ie: you need to install
the ruby-oci8 gem using:

gem install ruby-oci8 --version "< 2.0.0"

The other time people are getting errors like this seems to be when the
environment variables are not correctly set. You can check out whether
this is the case by executing:

$ irb

require ‘oci8’
=> true

If it barfs then you need to set your environment variables
appropriately (eg: DYLD_LIBRARY_PATH (Mac) or LD_LIBRARY_PATH
(everything else I think) plus maybe ORACLE_HOME and TNS_ADMIN).


#4

I was having this same issue, except I’m running on WEBrick. I had 1.x
and 2.x versions of the ruby-oci8 gem along with version 1.0.0.9250 of
the activerecord-oracle-adapter gem. Removing the 2.x ruby-oci8 fixed
it.

Thanks!!

Brendan Boesen wrote:

I had this same issue so in the interest of shortening someone else’s
search I thought I’d document it a little more.

The problem I was having (and I assume pepe) was that the OCI8::Cursor
interface has changed between 1.0.x and 2.0.x. The rails oracle support
(activerecord-oracle-adapter gem) uses 1.0.x. ie: you need to install
the ruby-oci8 gem using:

gem install ruby-oci8 --version "< 2.0.0"

The other time people are getting errors like this seems to be when the
environment variables are not correctly set. You can check out whether
this is the case by executing:

$ irb

require ‘oci8’
=> true

If it barfs then you need to set your environment variables
appropriately (eg: DYLD_LIBRARY_PATH (Mac) or LD_LIBRARY_PATH
(everything else I think) plus maybe ORACLE_HOME and TNS_ADMIN).


#5

Adam A.-2 wrote:

gem install ruby-oci8 --version "< 2.0.0"

On Snow Leopard I was able to use:

activerecord-oracle_enhanced-adapter (1.2.4)
ruby-oci8 (2.0.4)

for the enhanced adapter, use ‘oracle_enhanced’ in your database yml

View this message in context:
http://old.nabble.com/undefined-method-'define_a_column'-for-class-'OCI8%3A%3ACursor'-tp22642670p28587114.html
Sent from the RubyOnRails Users mailing list archive at Nabble.com.