# Undefined method 'define\_a\_column' for class 'OCI8::Cursor'

**URL:** <https://www.ruby-forum.com/t/undefined-method-define-a-column-for-class-oci8-cursor/163567>\
**Category:** Rails\
**Created:** [March 22, 2009, 3:30am UTC](https://www.ruby-forum.com/t/undefined-method-define-a-column-for-class-oci8-cursor/163567 "2009-03-22T03:30:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pepe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4da419/32.png) [@pepe](https://www.ruby-forum.com/u/pepe)\
**Post date:** [March 22, 2009, 3:30am UTC](https://www.ruby-forum.com/t/undefined-method-define-a-column-for-class-oci8-cursor/163567/1 "2009-03-22T03:30:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pepe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4da419/32.png) [@pepe](https://www.ruby-forum.com/u/pepe)\
**Post date:** [March 22, 2009, 3:47am UTC](https://www.ruby-forum.com/t/undefined-method-define-a-column-for-class-oci8-cursor/163567/2 "2009-03-22T03:47:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pepe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4da419/32.png) [@pepe](https://www.ruby-forum.com/u/pepe)\
**Post date:** [May 26, 2009, 7:49am UTC](https://www.ruby-forum.com/t/undefined-method-define-a-column-for-class-oci8-cursor/163567/3 "2009-05-26T07:49:04Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![pepe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4da419/32.png) [@pepe](https://www.ruby-forum.com/u/pepe)\
**Post date:** [November 25, 2009, 7:47pm UTC](https://www.ruby-forum.com/t/undefined-method-define-a-column-for-class-oci8-cursor/163567/4 "2009-11-25T19:47:18Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![pepe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4da419/32.png) [@pepe](https://www.ruby-forum.com/u/pepe)\
**Post date:** [May 17, 2010, 8:41pm UTC](https://www.ruby-forum.com/t/undefined-method-define-a-column-for-class-oci8-cursor/163567/5 "2010-05-17T20:41:58Z")

</div>

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](http://old.nabble.com/undefined-method-%27define_a_column%27-for-class-%27OCI8%3A%3ACursor%27-tp22642670p28587114.html)  
Sent from the RubyOnRails Users mailing list archive at [Nabble.com](http://Nabble.com).
