# MySQL connection issue

**URL:** <https://rubytalk.org/t/mysql-connection-issue/41467>\
**Category:** ruby-talk\
**Created:** [18 October 2007 08:18 UTC](https://rubytalk.org/t/mysql-connection-issue/41467 "2007-10-18T08:18:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harnish\_Botadra](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@Harnish\_Botadra](https://rubytalk.org/u/Harnish_Botadra)\
**Post date:** [18 October 2007 08:18 UTC](https://rubytalk.org/t/mysql-connection-issue/41467/1 "2007-10-18T08:18:30Z")

</div>

Hey All,

I am getting the following error in my Ruby Script:

> **···**
>
> --------------------------  
> mysql\_adapter.rb:322:in `connect': undefined method `[]' for  
> nil:NilClass (NoMethodError)  
> --------------------------
> 
> Essentially it occurs at a point when the script tries to connect to the  
> MySQL DB.
> 
> Sample code:
> 
> ---------------  
> class Test \< ActiveRecord::Base  
> &nbsp;&nbsp;def self.foo  
> &nbsp;&nbsp;end  
> end
> 
> Test.transaction do # =\> Point of error  
> &nbsp;&nbsp;Test.foo # =\> Another point of error occu...  
> end  
> ---------------
> 
> Any help greatly appreciated. Thanks.
> 
> ---Harnish  
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Phil](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@Phil](https://rubytalk.org/u/Phil)\
**Post date:** [18 October 2007 09:02 UTC](https://rubytalk.org/t/mysql-connection-issue/41467/2 "2007-10-18T09:02:22Z")

</div>

Is the mysql gem installed?

> **···**
>
> > -----Original Message-----  
> > From: list-bounce@example.com [mailto:list-bounce@example.com] On  
> > Behalf Of Harnish Botadra  
> > Sent: Donnerstag, 18. Oktober 2007 09:19  
> > To: ruby-talk ML  
> > Subject: MySQL connection issue...
> > 
> > Hey All,
> > 
> > I am getting the following error in my Ruby Script:
> > 
> > --------------------------  
> > mysql\_adapter.rb:322:in `connect': undefined method `' for  
> > nil:NilClass (NoMethodError)  
> > --------------------------
> > 
> > Essentially it occurs at a point when the script tries to connect to  
> > the  
> > MySQL DB.
> 
> --  
> Phill
