If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Installing DB2 for RoR on Ubuntu

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-11-11, 14:52
Shftz Shftz is offline
Registered User
 
Join Date: Mar 2011
Posts: 16
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
irb(main):002:0>

I have followed the README.txt but the one thing I can't seem to figure out is the ibm_db2.so 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
ion:0xb65de880>>
>>

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
Reply With Quote
  #2 (permalink)  
Old 03-12-11, 01:15
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On