# Accessing MSSQL with Rails 2.3.2 and Ruby 1.9.1

**URL:** <https://www.ruby-forum.com/t/accessing-mssql-with-rails-2-3-2-and-ruby-1-9-1/164596>\
**Category:** Rails\
**Created:** [April 2, 2009, 11:20pm UTC](https://www.ruby-forum.com/t/accessing-mssql-with-rails-2-3-2-and-ruby-1-9-1/164596 "2009-04-02T23:20:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![btomlin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/65b543/32.png) [@btomlin](https://www.ruby-forum.com/u/btomlin)\
**Post date:** [April 2, 2009, 11:20pm UTC](https://www.ruby-forum.com/t/accessing-mssql-with-rails-2-3-2-and-ruby-1-9-1/164596/1 "2009-04-02T23:20:34Z")

</div>

I am having a strange issue. I have upgraded to ruby 1.9.1 to do some  
testing on one of my machines. My app accesses a MSSQL database to  
pull in some information. Everything worked fine with ruby 1.8.6, but  
now if I try to navigate to a page that accesses that database I get  
this error:

DBI::InterfaceError in PagesController#company  
Unable to load driver ‘ODBC’ (underlying error: uninitialized constant  
DBI::DBD::ODBC)

If I use script/console everything works fine, and it worked fine in  
with ruby 1.8.6 as well. Does anyone have any ideas? I am baffled.

---

<div class="post-metadata">

**Author:** ![btomlin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/65b543/32.png) [@btomlin](https://www.ruby-forum.com/u/btomlin)\
**Post date:** [April 3, 2009, 12:06am UTC](https://www.ruby-forum.com/t/accessing-mssql-with-rails-2-3-2-and-ruby-1-9-1/164596/2 "2009-04-03T00:06:53Z")

</div>

On Thu, Apr 2, 2009 at 1:39 PM, btomlin \<\> wrote:

> If I use script/console everything works fine, and it worked fine in  
> with ruby 1.8.6 as well. Does anyone have any ideas? I am baffled.

What version of the MySQL gem you’re using with Ruby 1.9.1 and Rails  
2.3.2?

-Conrad

---

<div class="post-metadata">

**Author:** ![btomlin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/65b543/32.png) [@btomlin](https://www.ruby-forum.com/u/btomlin)\
**Post date:** [April 3, 2009, 12:37am UTC](https://www.ruby-forum.com/t/accessing-mssql-with-rails-2-3-2-and-ruby-1-9-1/164596/3 "2009-04-03T00:37:17Z")

</div>

It’s not MySQL, its MSSQL so I’m using activerecord-sqlserver-adapter  
(1.0.0.9250), dbd-odbc (0.2.4), and dbi (0.4.1)

---

<div class="post-metadata">

**Author:** ![btomlin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/65b543/32.png) [@btomlin](https://www.ruby-forum.com/u/btomlin)\
**Post date:** [November 25, 2009, 1:49pm UTC](https://www.ruby-forum.com/t/accessing-mssql-with-rails-2-3-2-and-ruby-1-9-1/164596/4 "2009-11-25T13:49:13Z")

</div>

Cosimo G. wrote:

> btomlin wrote:
> 
> > It’s not MySQL, its MSSQL so I’m using activerecord-sqlserver-adapter  
> > (1.0.0.9250), dbd-odbc (0.2.4), and dbi (0.4.1)
> 
> Yes, it looks like a newer version of ruby-odbc is needed:  
> [ODBC Binding for Ruby](http://www.ch-werner.de/rubyodbc/)
> 
> or we have just to compile it?

I’ve built of my own and work either with 191-p0-mswin32 and  
191-p243-mingw32

[http://files.tiscali.it/cosimo.g/My%20Files/ruby19-odbc-mswin32.zip](http://files.tiscali.it/cosimo.g/My%20Files/ruby19-odbc-mswin32.zip)

---

<div class="post-metadata">

**Author:** ![btomlin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/65b543/32.png) [@btomlin](https://www.ruby-forum.com/u/btomlin)\
**Post date:** [November 25, 2009, 9:08am UTC](https://www.ruby-forum.com/t/accessing-mssql-with-rails-2-3-2-and-ruby-1-9-1/164596/5 "2009-11-25T09:08:18Z")

</div>

btomlin wrote:

> It’s not MySQL, its MSSQL so I’m using activerecord-sqlserver-adapter  
> (1.0.0.9250), dbd-odbc (0.2.4), and dbi (0.4.1)

Yes, it looks like a newer version of ruby-odbc is needed:  
[http://www.ch-werner.de/rubyodbc/](http://www.ch-werner.de/rubyodbc/)

or we have just to compile it?

---

<div class="post-metadata">

**Author:** ![btomlin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/65b543/32.png) [@btomlin](https://www.ruby-forum.com/u/btomlin)\
**Post date:** [November 25, 2009, 9:25pm UTC](https://www.ruby-forum.com/t/accessing-mssql-with-rails-2-3-2-and-ruby-1-9-1/164596/6 "2009-11-25T21:25:34Z")

</div>

Connecting to Microsoft SQL Server from Mac OS X

[http://www.napcsweb.com/blog/2007/03/08/15/#more-15](http://www.napcsweb.com/blog/2007/03/08/15/#more-15)

---

<div class="post-metadata">

**Author:** ![btomlin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/65b543/32.png) [@btomlin](https://www.ruby-forum.com/u/btomlin)\
**Post date:** [December 2, 2009, 9:54am UTC](https://www.ruby-forum.com/t/accessing-mssql-with-rails-2-3-2-and-ruby-1-9-1/164596/7 "2009-12-02T09:54:28Z")

</div>

George Hill wrote:

> Cosimo G. wrote:
> 
> > I’ve built of my own and work either with 191-p0-mswin32 and  
> > 191-p243-mingw32
> > 
> > [http://files.tiscali.it/cosimo.g/My%20Files/ruby19-odbc-mswin32.zip](http://files.tiscali.it/cosimo.g/My%20Files/ruby19-odbc-mswin32.zip)
> 
> Any chance of making this available? I’m having the same difficulty  
> accessing MSSQL 2008 10.0.2531

I’m very sorry, in my mind ‘My Files’ was shared files.  
Of course, the ‘web’ folder is right one to share:  
[http://web.tiscali.it/mamva/ruby19-odbc-mswin32.zip](http://web.tiscali.it/mamva/ruby19-odbc-mswin32.zip)

Enjoy it.

Cosimo G.

---

<div class="post-metadata">

**Author:** ![btomlin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/65b543/32.png) [@btomlin](https://www.ruby-forum.com/u/btomlin)\
**Post date:** [December 2, 2009, 5:32am UTC](https://www.ruby-forum.com/t/accessing-mssql-with-rails-2-3-2-and-ruby-1-9-1/164596/8 "2009-12-02T05:32:13Z")

</div>

Cosimo G. wrote:

> Cosimo G. wrote:
> 
> > btomlin wrote:
> > 
> > > It’s not MySQL, its MSSQL so I’m using activerecord-sqlserver-adapter  
> > > (1.0.0.9250), dbd-odbc (0.2.4), and dbi (0.4.1)
> > 
> > Yes, it looks like a newer version of ruby-odbc is needed:  
> > [ODBC Binding for Ruby](http://www.ch-werner.de/rubyodbc/)
> > 
> > or we have just to compile it?
> 
> I’ve built of my own and work either with 191-p0-mswin32 and  
> 191-p243-mingw32
> 
> [http://files.tiscali.it/cosimo.g/My%20Files/ruby19-odbc-mswin32.zip](http://files.tiscali.it/cosimo.g/My%20Files/ruby19-odbc-mswin32.zip)

Any chance of making this available? I’m having the same difficulty  
accessing MSSQL 2008 10.0.2531

---

<div class="post-metadata">

**Author:** ![btomlin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/65b543/32.png) [@btomlin](https://www.ruby-forum.com/u/btomlin)\
**Post date:** [December 2, 2009, 11:12am UTC](https://www.ruby-forum.com/t/accessing-mssql-with-rails-2-3-2-and-ruby-1-9-1/164596/9 "2009-12-02T11:12:21Z")

</div>

Cosimo G. wrote:

> George Hill wrote:
> 
> > Cosimo G. wrote:
> > 
> > > I’ve built of my own and work either with 191-p0-mswin32 and  
> > > 191-p243-mingw32
> > > 
> > > [http://files.tiscali.it/cosimo.g/My%20Files/ruby19-odbc-mswin32.zip](http://files.tiscali.it/cosimo.g/My%20Files/ruby19-odbc-mswin32.zip)
> > 
> > Any chance of making this available? I’m having the same difficulty  
> > accessing MSSQL 2008 10.0.2531
> 
> I’m very sorry, in my mind ‘My Files’ was shared files.  
> Of course, the ‘web’ folder is right one to share:  
> [http://web.tiscali.it/mamva/ruby19-odbc-mswin32.zip](http://web.tiscali.it/mamva/ruby19-odbc-mswin32.zip)
> 
> Enjoy it.
> 
> Cosimo G.

Fantastic! I copied these two files to  
Ruby19\lib\ruby\1.9.1\i386-mingw32 and now its all working perfectly.  
Thank you very much. George.
