[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Which ODBC?

Ronald Fischer

5/29/2007 10:09:00 AM

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

--
Ronald Fischer <ronald.fischer@venyon.com>
Phone: +49-89-452133-162


5 Answers

vasudevram

5/29/2007 2:20:00 PM

0

On May 29, 3:09 pm, "Ronald Fischer" <ronald.fisc...@venyon.com>
wrote:
> 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.... 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
>
> --
> Ronald Fischer <ronald.fisc...@venyon.com>
> 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
http://www.dancin...
http://sourceforge.net/proje...


Gregory Brown

5/29/2007 7:56:00 PM

0

On 5/29/07, Ronald Fischer <ronald.fischer@venyon.com> wrote:
> 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.... 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.rubyre...

Or for a little more advanced functionality, Sequel:
http://sequel.rub...

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.

Gregory Brown

5/29/2007 7:57:00 PM

0

On 5/29/07, Gregory Brown <gregory.t.brown@gmail.com> wrote:

> Ruport's Query support:
> http://api.rubyre...

whoops, here's a direct link:
http://api.rubyre...classes/Ruport/Query.html

Ronald Fischer

5/30/2007 1:43:00 PM

0

> > - 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.rubyre...
>
> Or for a little more advanced functionality, Sequel:
> http://sequel.rub...
>
> 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...),
but:

gem install -r ruby-dbi

says:

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

Ronald
--
Ronald Fischer <ronald.fischer@venyon.com>
Phone: +49-89-452133-162


Gregory Brown

5/30/2007 2:34:00 PM

0

On 5/30/07, Ronald Fischer <ronald.fischer@venyon.com> 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.rubyre...
> >
> > Or for a little more advanced functionality, Sequel:
> > http://sequel.rub...
> >
> > 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...),
> 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.