The Ruby DBI module includes the code that implements the general DBI layer, as well as a set of DBD-level drivers. Many of these drivers require that you have additional software installed. For example, the database driver for MySQL is written in Ruby and provides a binding to the Ruby MySQL module, which itself is written in C and provides a binding to the MySQL C client API. This means that if you want to write DBI scripts to access MySQL databases, you'll need to have both the Ruby MySQL module and the C API installed. For further information on the Ruby MySQL module, see the document referenced in the "Resources" section. Here, I assume that the MySQL module is installed and available for use by DBI.
After you have satisfied the prerequisites described in the previous section, you can install the Ruby DBI module, which can be obtained from the following site:
http://rubyforge.org/projects/ruby-dbi/The DBI module is distributed as a compressed tar file, which you should unpack after downloading it. For example, if the current version is 0.1.1, the distribution file can be unpacked using either of the following commands:
% tar zxf dbi-0.1.1.tar.gzAfter unpacking the distribution, change location into its top-level directory and configure it using the setup.rb script in that directory. The most general configuration command looks like this, with no arguments following the config argument:
% gunzip < dbi-0.1.1.tar.gz | tar xf -
% ruby setup.rb configThat command configures the distribution to install all drivers by default. To be more specific, provide a --with option that lists the particular parts of the distribution you want to use. For example, to configure only the main DBI module and the MySQL DBD-level driver, issue the following command:
% ruby setup.rb config --with=dbi,dbd_mysqlAfter configuring the distribution, build and install it:
% ruby setup.rb setupYou might need to run the installation command as root.
% ruby setup.rb install
The rest of this document uses the following notational conventions:
ruby setup.rb config --with=dbi,dbd_mysql这句话是主要的问题,以前就是把这个选项搞错了