On Mon, Apr 07, 2003 at 05:26:21AM +0900, Oliver Nelson wrote:
> are there any
> bindings for oracle, db2 or pervasive available/in the works?

I can answer about Oracle: you have a choice of two bindings. The package
"oracle" is a binding to the older OCI7 library and "ruby-oci8" uses, well,
OCI8 :-) Both available from http://raa.ruby-lang.org/

I have used both successfully with Oracle 9i/Solaris. OCI8 has the advantage
of mapping to more native datatypes, e.g. a Number column gives a Fixnum,
whilst 'oracle' seems to map everything to String. I've only used them via
DBI, rather than their native bindings, since that lets me chop and change
between drivers and databases with no code changes.

I am currently in the process of rewriting an existing C/OCI8 in-house
database to Ruby, basically because the C version had become unmaintainable.
The Ruby version is a fraction of the size, does more things, and is a joy
to program in - even for me who hates databases as a rule :-)

> Should I being using Ruby as a scripting language for little stuff or
> as a "glue" tool, or should I write application in it?

I'd certainly say you can write applications in it. Unlike (say) Perl, where
applications have a tendency to sprawl and become unmaintainable, Ruby lets
you write at the appropriate abstraction level for your code. If your
database contains customers, or bills, or services, you can neatly represent
them as objects with methods. You can do that in Perl too, but you have to
expend a lot of effort in doing so.

I also think it's worth buying into the "unit testing" concept, which Ruby
supports in the "testunit" library. Having an automated test script which
confirms that you haven't broken anything lets you make rapid changes and
rewrites to code (refactoring) without having to worry about whether you've
broken something.

Regards,

Brian.