Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ODBC OG/ActiveRecords

0 views
Skip to first unread message

Luke Galea

unread,
Mar 11, 2005, 10:18:40 AM3/11/05
to
Hi Ruby Talk,

I'd like to write an interface between an MS-Access DB and a Sybase Anywhere
DBs in Ruby.. Neither of these have native ruby drivers so I am resigned to
using Ruby-ODBC..

BUT: I would like to use a nice object-relational library like ActiveRecord or
OG.. Has anyone ever had any success using either over ODBC? I would expect
that if a generic "simple sql syntax" adapter were available it would likely
work on both DBs..

Thanks in advance!


David Heinemeier Hansson

unread,
Mar 11, 2005, 10:40:32 AM3/11/05
to
> Has anyone ever had any success using either over ODBC? I would expect
> that if a generic "simple sql syntax" adapter were available it would
> likely
> work on both DBs..

Generic ODBC adapters are problematic because the databases underneath
might use different strategies for stuff like auto-incremented columns.
A Access or Sybase adapter that goes through ODBC is certainly
possible. I know that shashank and a few others were looking into that
for Active Record at some point.
--
David Heinemeier Hansson,
http://www.basecamphq.com/ -- Web-based Project Management
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://www.loudthinking.com/ -- Broadcasting Brain

Paul Duncan

unread,
Mar 11, 2005, 10:43:57 AM3/11/05
to

I've written stuff at work that uses Ruby/ODBC to query an Access file.

> Thanks in advance!

--
Paul Duncan <pa...@pablotron.org> pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562

signature.asc

Kirk Haines

unread,
Mar 11, 2005, 10:53:40 AM3/11/05
to
Luke Galea wrote:

> BUT: I would like to use a nice object-relational library like
> ActiveRecord or OG.. Has anyone ever had any success using either over
> ODBC? I would expect that if a generic "simple sql syntax" adapter were
> available it would likely work on both DBs..

There is a DBI driver for ODBC, which means you should be able to use the
Kansas ORM. Kansas, as an ORM, has been feature-incomplete, but stable for
many months, and I use it on probably 20 different production applications.
It used DBI for simplicity and coverage, making it lightweight.

I say feature-incomplete because it has rough edges with regard to usage
exceptions and handling of object is_a relationships and things of that
nature. It also does not have the table creation abilities that Og does,
though I have been considering going down that road.

Tobi Fuchs has volunteered some time to help clean it up and advance it to
the next level, though, so with a little good fortune, a new version should
be forthcoming in the not too distant future.

Take a look: http://enigo.com/projects/kansas/tutorial/what_is_it.html

It's available for download from Rubyforge:
http://rubyforge.org/projects/kansas

Give me a shout if you have any questions. I have never tried it with the
ODBC driver.


Kirk Haines

Shashank Date

unread,
Mar 11, 2005, 11:52:04 AM3/11/05
to

--- David Heinemeier Hansson <da...@loudthinking.com>
wrote:

> Generic ODBC adapters are problematic because the
> databases underneath
> might use different strategies for stuff like
> auto-incremented columns.

Correct !

> I know that shashank and a few others were
> looking into that for Active Record at some point.

Yes ... but there were a couple of issues (e.g. SELECT
. TOP syntax, handling of string constants etc) that
prevented me from backporting my adapter seamlessly
into Active Record. I will gladly share my (old) code
with anybody who is interested.

-- shanko


__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/


George Moschovitis

unread,
Mar 12, 2005, 2:16:44 AM3/12/05
to
Hello Luke,

I 'll probably create an Og/ODBC driver real soon as I 'll need it for
a project of mine. However I am not sure, how successfully this will be
integrated with Og. It will probably be just 'good enough' for my
purpose.

Perhaps you could try and write this ODBC adapter yourself and
contribute the driver (as Matt Bowen did for the experimental Oracle
driver).

regards,
George.

0 new messages