DB2 10.5 for Linux, UNIX, and Windows

Installing the IBM_DB Ruby driver and Rails adapter as a Ruby gem

The IBM_DB Ruby driver and Rails adapter is available as a Ruby gem for installation in the IBM® data server clients. Ruby Gems is the standard packaging and installation framework for libraries and applications in the Ruby runtime environment. A single file for each bundle is called a gem, which complies to the standardized package format. This package is then distributed and stored in a central repository, allowing simultaneous deployment of multiple versions of the same library or application.

Before you begin

Similar to package management and bundles (.rpm, .deb) used in Linux distributions, these gems can also be queried, installed, uninstalled, and manipulated through the gem utility.

The gem utility can: seamlessly query the remote Gemcutter central repository; and look up and install any of the many readily available utilities. When the IBM_DB gem is installed, the IBM_DB Ruby driver and Rails adapter is immediately accessible from any application in the Ruby runtime environment, through the require command:

require 'ibm_db'
or on Windows:
require 'mswin32/ibm_db'

Procedure

To install the IBM_DB Ruby driver and Rails adapter as a Ruby gem:

  1. On all supported platforms, issue the gem install command to install the IBM_DB Ruby driver and Rails adapter:
    $ gem install ibm_db
    If you are installing the gem from the IBM data server product, specify the gem file location with the gem install command:
    $ gem install /home/db2inst1/sqllib/ruby64/ibm_db-X.X.XX.gem
  2. Before running any Ruby script that connects to the IBM database server, you must ensure that the IBM_DB Ruby driver can access the CLI driver on Linux or UNIX platforms by adding the libdb2.so file path to the LD_LIBRARY_PATH environmental variable. If the IBM_DB Ruby driver cannot access the CLI driver, the missing libraries - libdb2.so.1 error message is returned to your Ruby program.

    When using the IBM Data Server Driver Package software, the libdb2.so file is in the odbc_cli_driver/linux/clidriver/lib directory.

    In the IBM data server product environment, libdb2.so is in the sqllib/lib/ path.