# Which ODBC?

**URL:** <https://www.ruby-forum.com/t/which-odbc/105371>\
**Category:** Ruby\
**Created:** [May 29, 2007, 12:10pm UTC](https://www.ruby-forum.com/t/which-odbc/105371 "2007-05-29T12:10:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [May 29, 2007, 12:10pm UTC](https://www.ruby-forum.com/t/which-odbc/105371/1 "2007-05-29T12:10:31Z")

</div>

Hello,

I am investigating ways to connect my Ruby (non-Rails) application on  
Windows  
to either MSSQL, MySql or Oracle databases. ODBC seems to be a common  
way  
for accessing them, so I wonder how to best access ODBC from Ruby.

Searching on the Web, I found solutions using DBI, or the ODBC Library  
at [ODBC Binding for Ruby](http://www.ch-werner.de/rubyodbc/). Now I wonder:

- Are there other alternative ODBC interfaces?
- Are some of them available as gem? Which ones?
- Are there interfaces written in “plain ruby”, so that the application  
might also run under JRuby? (Of course I can use JDBC on JRuby as an  
alternative - I’m here more interested in Ruby vs. JRuby compatibility).

Any suggestions?

Ronald

---

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [May 29, 2007, 1:02pm UTC](https://www.ruby-forum.com/t/which-odbc/105371/2 "2007-05-29T13:02:37Z")

</div>

i am using Active Record in some non-rails apps.  
Very handy. Easy to do also,

shawn

---

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [May 29, 2007, 4:26pm UTC](https://www.ruby-forum.com/t/which-odbc/105371/3 "2007-05-29T16:26:17Z")

</div>

On May 29, 3:09 pm, “Ronald F.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> –  
> Ronald F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> Phone: +49-89-452133-162

I don’t know about the pros and cons of alternative ODBC libraries for  
Ruby, so can’t say anything there. But here are some other ideas:

- Why not try out a few of the different ODBC options and evaluate  
them? And, preferably, post here or put up an article somewhere with  
your findings, for the benefit of others ? including me 🙂 I’d  
appreciate that as I intend to do some work with Ruby/DBI/ODBC. If you  
don’t I’ll probably do it myself after a while.

- To use the same code in both Ruby and JRuby, if there are no pure-  
Ruby libraries, you could consider writing a thin wrapper of your own  
with alternative underlying Ruby/DBI and JRuby/JDBC implementations. I  
know this would mean writing more code but it might not be all that  
much, and you’d then have that code to use in other projects as well.  
The ODBC/DBI/JDBC interfaces/API are all roughly similar, so you might  
not have too much work to do, plus you could always bypass your own  
wrapper and call through directly to whichever underlying interface  
you’re really using in a particular app, for any special cases that  
your wrapper can’t handle.

Just my 2c …

Vasudev Ram  
Dancing Bison Enterprises

> **[dancingbison.com](http://ww38.dancingbison.com/)**
>
> Learn Python Programming

> **[Conversion of other file formats to PDF](https://sourceforge.net/projects/xtopdf/)**
>
> Download Conversion of other file formats to PDF for free. xtopdf: Tools to convert other formats (x) to PDF; x as in math.

---

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [May 29, 2007, 9:57pm UTC](https://www.ruby-forum.com/t/which-odbc/105371/4 "2007-05-29T21:57:37Z")

</div>

On 5/29/07, Gregory B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Ruport’s Query support:  
> [http://api.rubyreports.org/](http://api.rubyreports.org/)

whoops, here’s a direct link:  
[http://api.rubyreports.org/classes/Ruport/Query.html](http://api.rubyreports.org/classes/Ruport/Query.html)

---

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [May 29, 2007, 9:56pm UTC](https://www.ruby-forum.com/t/which-odbc/105371/5 "2007-05-29T21:56:37Z")

</div>

On 5/29/07, Ronald F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> - Are there other alternative ODBC interfaces?

On windows, DBI and ODBC come with the one click installer, that means  
you could use if you wanted something pretty raw but still clean:

Ruport’s Query support:  
[http://api.rubyreports.org/](http://api.rubyreports.org/)

Or for a little more advanced functionality, Sequel:  
[http://sequel.rubyforge.org](http://sequel.rubyforge.org)

And ActiveRecord works, too

> - Are some of them available as gem? Which ones?

All three of the above mentioned are

> - Are there interfaces written in “plain ruby”, so that the application  
> might also run under JRuby? (Of course I can use JDBC on JRuby as an  
> alternative - I’m here more interested in Ruby vs. JRuby compatibility).

Ruby DBI and Ruport are close to running on JRuby, but not quite.  
I’d love to see folks help get this up and running though.

Sequel, I’m not sure. I think it’s pure ruby but I don’t know about  
the database drivers for ODBC.

---

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [May 30, 2007, 3:43pm UTC](https://www.ruby-forum.com/t/which-odbc/105371/6 "2007-05-30T15:43:56Z")

</div>

> And ActiveRecord works, too

Ruport seems a bit of an overkill to me, but I would like to try  
DBI and ActiveRecord. I was able to find ActiveRecord, by

gem install -r ActiveRecord

but I don’t see how I could install DBI. According to  
Rubyforge, it should be ‘ruby-dbi’  
([http://rubyforge.org/projects/ruby-dbi/](http://rubyforge.org/projects/ruby-dbi/)),  
but:

gem install -r ruby-dbi

says:

ERROR: While executing gem … (Gem::GemNotFoundException)

Ronald

---

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [May 30, 2007, 4:35pm UTC](https://www.ruby-forum.com/t/which-odbc/105371/7 "2007-05-30T16:35:15Z")

</div>

On 5/30/07, Ronald F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 
> 
> but:
> 
> gem install -r ruby-dbi

DBI is not available as a gem. It’s somewhat tricky to install on  
various systems, but it’s included with the one click installer for  
Ruby on windows (as is a suitable odbc driver).

In terms of getting it working with JRuby, good luck, many folks would  
be happy to see that happen.
