Rails Adapter/Ruby Driver for IBM i (fork)


  • Tony Cairns, IBM
  • Aaron Bartell, KrengelTech

Build and test: IBM_DB_Adapter/ibm_db/README_IBM_i



Overwrite /PowerRuby

Note, it would be best to make a backup of /PowerRuby folder before doing the below. Also, you can download the gem via FTP and upload to IBM i via FTP if you don't have curl.

$ curl -OkL
$ gem uninstall ibm_db
$ gem install ./ibm_db-2.5.14-powerpc-aix-6_v7.1_prV20_GA05.gem

Alternate Install Location

Preferred approach because installing in /PowerRuby will get overwritten with /PowerRuby upgrade and there's no way to revert to go back to original /PowerRuby version.

Create the alternate directory where the ibm_db gem will be installed and then alter GEM_HOME and GEM_PATH accordingly.

$ mkdir -p /ruby/gemsets/ruby-ibm_db
$ export GEM_HOME=/ruby/gemsets/ruby-ibm_db
$ export GEM_PATH=/ruby/gemsets/ruby-ibm_db:/PowerRuby/prV2R0/lib/ruby/gems/2.0.0
$ curl -OkL
$ gem install ./ibm_db-2.5.14-powerpc-aix-6_v7.1_prV20_GA05.gem

Build and Compile

Assumes: Note: Must be built on IBM i v7.1 in order to work on v7.1 and v7.2. Note: This is only necessary if you are looking to actually build the driver with a C compiler. If you just want to install the precompiled driver then go to the Install section in this document.

Best practice is to build/compile into directory other than /PowerRuby. File accomplishes a different install location by default (i.e. /ruby/gemsets/ruby-ibm_db).

$ export PATH=/PowerRuby/prV2R0/bin:$PATH
$ export LIBPATH=/PowerRuby/prV2R0/lib
$ git clone
$ cd ruby-ibm_db/IBM_DB_Adapter/ibm_db/
$ ./

There will now be two new files:

  • ibm_db-2.5.14.gem - Gem created with 'gem build ...'
  • ibm_db-2.5.14-powerpc-aix-6.gem - "Fat gem" created with gem compile ... that includes C binaries. This file is meant to be renamed to have the OS version and PowerRuby version included and is meant for distribution. i.e. ibm_db-2.5.14-powerpc-aix-6_v7.1_prV20.gem.


Increment ruby-ibm_db/IBM_DB_Adapter/ibm_db/version.txt. Do NOT change the version of the actual gem itself.

Rename final distributable to include IBM i OS version and version of PowerRuby this was compiled with.

$ mv ibm_db-2.5.14-powerpc-aix-6.gem ibm_db-2.5.14-powerpc-aix-6_v7.1_prV20.gem

Upload to


$ export PATH=/PowerRuby/prV2R0/bin:$PATH
$ export LIBPATH=/PowerRuby/prV2R0/lib
$ git clone
$ cd ruby-ibm_db/IBM_DB_Adapter/ibm_db/test/IBMi/
$ rake