From: Nicholas Quaine Date: 2008-04-26T01:16:53+09:00 Subject: DBI:ibm_db connection for IBM DB2 database Hello, I am attempting to make a DBI connection from Ruby code running on Win32 (XP) machine to an IBM DB2 v9.5 database running under Linux On the Win32 machine, I have Ruby 1.8.6 (installed with the one-click installer) and have successfully launched the following gem installation commands for the IBM DB drivers and required libraries: >gem install activesupport -v 1.4.2 >gem install activerecord -v 1.15.3 >gem install ibm_db -v 0.8.5 I have also (as required by the IBM documentation at http://rubyforge.org/docman/view.php/2361/967/IBM_DB-0.6.0.pdf) added ‘ibm_db’ to the list of connection adapters on line77 of gems\1.8\gems\activerecord-1.15.3\lib\active_record.rb : RAILS_CONNECTION_ADAPTERS = %w( mysql postgresql sqlite firebird sqlserver db2 oracle sybase openbase frontbase ibm_db ) Here is the ruby code : ------------- require 'rubygems' gem 'ibm_db' require 'dbi' # Connect to a database dbh = DBI.connect('DBI:ibm_db:host=localhost;port=50000;database=MY_DB;', 'username', 'password') # Select some data sth = dbh.prepare('select * from my_table') sth.execute # Print out selected data while row=sth.fetch do p row end --------------- Error reported is as follows : C:\dev\ruby\dbtest>dbtest.rb c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:329:in `load_driver': Unable to load drive r 'ibm_db' (DBI::InterfaceError) from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:227:in `_get_full_driver' from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:213:in `connect' from C:/dev/ruby/dbtest/dbtest.rb:4 --------------- So it seems the IBM DB2 drivers are not found but I cannot see why Any help is much appreciated thanks, Nick Quaine -- Posted via http://www.ruby-forum.com/.