Ruby Developer's Guide

The existence of a variety of data-storage solution interfaces is essential for broad acceptance of a language like Ruby. Certainly, interfaces to relational databases such as Oracle, MySql, PostgreSQL, or DB2 are the most important, with those to hierarchical databases like Lightweight Directory Access Protocol (LDAP) and Berkley DBM file databases; or flat-file databases like Comma Separated Values (CSV) coming in a close second. That being said, the ability to access databases of different vendors with the same interface is also a desirable trait.
In Ruby, all of the aforementioned is already reality. Ruby's equivalent to Perl's DataBase Interface (DBI) is Ruby/DBI which acts as a uniform way to access a lot of different databases (for example, Oracle, DB2, InterBase, PostgreSQL or MySql) with a simple yet powerful interface. And with Ruby/ODBC, the Open Database Connectivity (ODBC) binding for Ruby, you can access any database for which an ODBC driver exists. Besides Ruby/DBI and Ruby/ODBC, a lot of other database-dependent libraries for Ruby exist, including sybase-ctlib for Sybase databases, Ruby/LDAP for accessing LDAP directories, gdbm, ndbm, bdb, and cbd for Berkeley DBM files or library csv for comma separated flat-files, to mention only those not yet incorporated into Ruby/DBI.
This chapter gives an in-depth introduction into Ruby/DBI, briefly introduces Ruby/ODBC, and shows how to use Ruby/LDAP to access LDAP directories. Other solutions to store data are also exhibited, for example how to use the Berkley DB embedded database system or CSV files.
Ruby/DBI is a...