# ActiveRecord class method count issues

**URL:** <https://www.ruby-forum.com/t/activerecord-class-method-count-issues/87905>\
**Category:** Rails\
**Created:** [March 6, 2007, 7:23pm UTC](https://www.ruby-forum.com/t/activerecord-class-method-count-issues/87905 "2007-03-06T19:23:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dfg59](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e0b2c6/32.png) [@dfg59](https://www.ruby-forum.com/u/dfg59)\
**Post date:** [March 6, 2007, 7:23pm UTC](https://www.ruby-forum.com/t/activerecord-class-method-count-issues/87905/1 "2007-03-06T19:23:53Z")

</div>

All -

I’m using ActiveRecord outside of the rails framework and I’m having an  
issue using the class method count. I’m connected to an Oracle 10g  
database and my find commands are working fine:

Employee.find(:first) -\> Gives me the first record just as expected

However, when I try:

Employee.count

I get the following error:

irb(main):004:0\> Employee.count  
ActiveRecord::ConnectionNotEstablished:  
ActiveRecord::ConnectionNotEstablished

I literally did these lines one after another in the same irb session.  
Bizarre…

Thanks,  
Drew

---

<div class="post-metadata">

**Author:** ![dfg59](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e0b2c6/32.png) [@dfg59](https://www.ruby-forum.com/u/dfg59)\
**Post date:** [April 30, 2008, 10:15pm UTC](https://www.ruby-forum.com/t/activerecord-class-method-count-issues/87905/2 "2008-04-30T22:15:45Z")

</div>

Drew O. wrote:

> All -
> 
> I’m using ActiveRecord outside of the rails framework and I’m having an  
> issue using the class method count. I’m connected to an Oracle 10g  
> database and my find commands are working fine:
> 
> Employee.find(:first) -\> Gives me the first record just as expected
> 
> However, when I try:
> 
> Employee.count
> 
> I get the following error:
> 
> irb(main):004:0\> Employee.count  
> ActiveRecord::ConnectionNotEstablished:  
> ActiveRecord::ConnectionNotEstablished
> 
> I literally did these lines one after another in the same irb session.  
> Bizarre…
> 
> Thanks,  
> Drew

I’m having the same problem. Did you ever find a solution?

Earle
