[Seaside] RDB access (was: Rolling with Ruby on Rails vs. Seaside)
benjamin.pollack at gmail.com
Sun Jan 30 19:29:11 CET 2005
On Sat, 29 Jan 2005 16:56:36 -0500, Milan Zimmermann
<milan.zimmermann at sympatico.ca> wrote:
> On January 29, 2005 05:24 pm, Todd Blanchard wrote:
> > I'm curious how did ruby get such good db coverage? Is it just using
> > odbc?
> Good Point .. I am sure someone here knows .. I checked
> and it says:
> "What databases?
> MySQL, PostgreSQL, SQLite, SQL Server, and DB2 are supported out of the box.
> Oracle and FrontBase drivers are in the works."
> so it appears it is not ODBC.
> Here http://api.rubyonrails.com/?u=ar.rubyonrails.com they say:
> Database support
> Active Record ships with adapters for MySQL/Ruby (compatible with
> Ruby/MySQL), PostgreSQL, and SQLite (needs SQLite 2.8.13+ and SQLite-Ruby
> 1.1.2+). The adapters are around 100 lines of code fulfilling the interface
> specified by ActiveRecord::ConnectionAdapters::AbstractAdapter. Writing a new
> adapter should be a small task - especially considering the extensive test
> suite that'll make sure you're fulfilling the contract.
> So I'd guess some sort of wrappers around "native" interface to each database.
> Which, for example for middle tier application against Oracle would mean, I
> assume, installing something like SQL-net client in the middle-tier...
The database drivers are indeed all native. Rails leverages existing
Ruby database packages that have been available for some time. Most of
these package up native C libraries in Ruby classes, although there is
an increasing movement to rewrite these in pure Ruby. There would be
nothing preventing you from writing an ODBC database package for Ruby,
and one exists (http://www.ch-werner.de/rubyodbc/) but Rails doesn't
support it. The adaptors referenced in the Rails documentation refer
to linking those existing database drivers to ActiveRecord. This
basically just involves explaining the syntax for select-from-where
and a few other minor things, which is why the adaptors are so short.
But they do rely upon existing database drivers to work.
I suspect that there are more available for Ruby than Squeak because
Ruby's origin as a scripting language encouraged its use in areas
where it needed to connect to legacy applications using existing
databases. Squeak, in contrast, generally has been used where there is
no need to interface with legacy apps, so it develops its own
solutions. That's just a guess, though.
More information about the Seaside