Which ODBC?

R

Ronald Fischer

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 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

--=20
Ronald Fischer <[email protected]>
Phone: +49-89-452133-162
=20
 
V

vasudevram

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
athttp://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

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
http://www.dancingbison.com
http://sourceforge.net/projects/xtopdf
 
G

Gregory Brown

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 http://www.ch-werner.de/rubyodbc/. Now I wonder:

- 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/

Or for a little more advanced functionality, Sequel:
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.
 
R

Ronald Fischer

- Are there other alternative ODBC interfaces?
=20
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:
=20
Ruport's Query support:
http://api.rubyreports.org/
=20
Or for a little more advanced functionality, Sequel:
http://sequel.rubyforge.org
=20
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=20
Rubyforge, it should be 'ruby-dbi'
(http://rubyforge.org/projects/ruby-dbi/),
but:

gem install -r ruby-dbi

says:

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

Ronald
--=20
Ronald Fischer <[email protected]>
Phone: +49-89-452133-162
=20
 
G

Gregory Brown

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/),
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,962
Messages
2,570,134
Members
46,692
Latest member
JenniferTi

Latest Threads

Top