# Problem with Ruby ODBC in Linux

**URL:** <https://rubytalk.org/t/problem-with-ruby-odbc-in-linux/40528>\
**Category:** ruby-talk\
**Created:** [10 September 2007 20:30 UTC](https://rubytalk.org/t/problem-with-ruby-odbc-in-linux/40528 "2007-09-10T20:30:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_Kong](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@Sam\_Kong](https://rubytalk.org/u/Sam_Kong)\
**Post date:** [10 September 2007 20:30 UTC](https://rubytalk.org/t/problem-with-ruby-odbc-in-linux/40528/1 "2007-09-10T20:30:14Z")

</div>

Hi,

I am trying to connect to a SQL Server 7.0 DB from a Linux box using  
Ruby DBI & ODBC.

1. ruby -v  
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]

2. ruby-odbc installed ok.  
ruby-odbc-0.9995\> ruby test.rb dsn\_name username password  
all tests ok!

3. DBI is properly installed.

> require 'dbi'

=\> true

BUT, the following fails in the same irb session.

> DBI.connect('dbi:ODBC:dsn\_name', 'username', password')

DBI::InterfaceError: Unable to load driver 'ODBC'  
...

What is missing?  
Or how can I track it down?

Mysql works fine.  
I believe I set up the ODBC configuration correctly.  
I can access the SQL Server via isql command.

Thanks.

Sam

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Sam\_Kong](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@Sam\_Kong](https://rubytalk.org/u/Sam_Kong)\
**Post date:** [10 September 2007 20:39 UTC](https://rubytalk.org/t/problem-with-ruby-odbc-in-linux/40528/2 "2007-09-10T20:39:17Z")

</div>

I fixed the problem.

I reinstalled Ruby DBI.

ruby setup.rb config --with=dbi,dbd\_odbc  
ruby setup.rb setup  
ruby setup.rb install

I think the --with=dbi,dbd\_odbc made the difference.

Sam

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
