Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2011

    Unanswered: Installing DB2 for RoR on Ubuntu

    I have sucessfully installed DB2 on Ubuntu 10.04 to be used in conjunction with my rails app. I'm not quite sure if everything is properly setup because I keep getting an error "Failed to load IBM DB2 Ruby driver" .

    From irb:
    irb(main):001:0> require 'ibm_db2'
    LoadError: no such file to load -- ibm_db2
    from (irb):1:in `require'
    from (irb):1

    I have followed the README.txt but the one thing I can't seem to figure out is the and how to compile it and where to put it. I put the ibm_db2_adapter into /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.9/lib/active_record/connection_adapters and added RAILS_CONNECTION_ADAPTERS = %w( mysql postgresql sqlite firebird sqlserver db2 oracle sybase openbase ibm_db2 ) to the active_record.rb.

    To test the initial connection, I changed the adapter in the YAML file to ibm_db and this was the output:

    >> ActiveRecord::Base.connection
    => #<ActiveRecord::ConnectionAdapters::IBM_DBAdapter: 0xb65de86c @security=nil, @
    last_verification=0, @workstation=nil, @conn_options={3271982=>1}, @servertype=#
    <ActiveRecord::ConnectionAdapters::IBM_DB2_LUW_COB RA:0xb65db07c @offset=nil, @li
    mit=nil, @adapter=#<ActiveRecord::ConnectionAdapters::IBM_D BAdapter:0xb65de86c .
    ..>>, @set_quoted_literal_replacement=0, @handle_lobs_triggered=false, @schema="
    db2inst1", @runtime=0.359535217285156, @application=nil, @pstmt_support_on=true,
    @port=50000, @logger=#<ActiveSupport::BufferedLogger:0xb6d62b60 @log=#<File:/ho
    me/*****/log/production.log>, @level=1, @buffer={},
    @guard=#<Mutex:0xb6d58a5c>, @auto_flushing=1000>, @sql_parameter_values=[], @us
    ername="db2inst1", @account=nil, @start_id=1, @authentication=nil, @host="localh
    ost", @prepared_sql="SELECT * FROM nds_inis WHERE (nds_inis.key_string = ?) FET
    CH FIRST 1 ROWS ONLY", @query_cache_enabled=false, @sql=[], @password="********
    ****", @database="*****", @app_user=nil, @timeout=0, @connection=#<IBM_DB::Connect

    However if I change the adapter to ibm_db2 and run the same I get 'ibm_db2_connection' : Failed to load IBM DB2 Ruby driver. (LoadError)

    Any help with this would be greatly appreciated. Thanks in advance

  2. #2
    Join Date
    Jun 2003
    Toronto, Canada
    Provided Answers: 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts