我正在尝试安装“ibm db”gem并验证安装。我在Windows7上运行,我试着用32位来做所有的事情。我需要连接的数据库是ibm iseries上的db2。以下是我目前使用的步骤。
• gem install “ibm_db”
• irb
• require “ibm_db”
我得到以下结果:
c:\Users\Bob\RubymineProjects\beginruby>gem install ibm_db
Fetching: ibm_db-2.5.11-x86-mingw32.gem (100%)
Successfully installed ibm_db-2.5.11-x86-mingw32
1 gem installed
Installing ri documentation for ibm_db-2.5.11-x86-mingw32...
Installing RDoc documentation for ibm_db-2.5.11-x86-mingw32...
c:\Users\Bob\RubymineProjects\beginruby>gem list
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.2.9, 3.2.7, 3.2.3, 3.1.8, 3.0.12, 3.0.1)
actionpack (3.2.9, 3.2.7, 3.2.3, 3.1.8, 3.0.12, 3.0.1)
activemodel (3.2.9, 3.2.7, 3.2.3, 3.1.8, 3.0.12, 3.0.1)
activerecord (3.2.9, 3.2.7, 3.2.3, 3.1.8, 3.0.12, 3.0.1)
activeresource (3.2.9, 3.2.7, 3.2.3, 3.1.8, 3.0.12, 3.0.1)
activesupport (3.2.9, 3.2.7, 3.2.3, 3.1.8, 3.0.12, 3.0.1)
addressable (2.3.2)
annotate (2.5.0, 2.4.1.beta1, 2.4.0)
archive-tar-minitar (0.5.2)
arel (3.0.2, 2.2.3, 2.0.10, 1.0.1)
autotest (4.4.6, 4.3.2)
autotest-fsevent (0.2.8)
autotest-growl (0.2.16)
autotest-rails (4.1.2)
autotest-rails-pure (4.1.2, 4.1.0)
bcrypt-ruby (3.0.1 x86-mingw32)
bigdecimal (1.1.0)
bootstrap-sass (2.2.1.1, 2.0.0)
bootstrap-will_paginate (0.0.9, 0.0.6)
builder (3.1.4, 3.0.4, 2.1.2)
bundler (1.2.3, 1.0.22)
capybara (2.0.1, 2.0.0, 1.1.3, 1.1.2)
childprocess (0.3.6)
coderay (1.0.8)
coffee-rails (3.2.2, 3.1.1)
coffee-script (2.2.0)
coffee-script-source (1.4.0)
columnize (0.3.6)
cucumber (1.2.1)
cucumber-rails (1.3.0, 1.2.1)
database_cleaner (0.9.1, 0.7.0)
debugger-ruby_core_source (1.1.5)
diff-lcs (1.1.3)
erubis (2.7.0, 2.6.6)
excon (0.16.10)
execjs (1.4.0)
factory_girl (4.1.0, 2.3.2, 1.3.3)
factory_girl_rails (4.1.0, 1.4.0, 1.0)
faker (1.1.2, 1.0.1, 0.3.1)
ffi (1.2.0 x86-mingw32, 1.1.5 x86-mingw32)
gherkin (2.11.5 x86-mingw32)
gravatar_image_tag (1.1.3, 1.0.0.pre2, 0.1.0)
guard (1.5.4)
guard-rspec (2.3.1, 2.3.0, 0.5.5)
guard-spork (1.4.0, 0.3.2)
heroku (2.33.3, 2.33.2, 2.33.1)
heroku-api (0.3.7, 0.3.6)
hike (1.2.1)
hpricot (0.8.6)
i18n (0.6.1, 0.5.0, 0.4.2)
ibm_db (2.5.11 x86-mingw32)
io-console (0.3)
journey (1.0.4)
jquery-rails (2.1.4, 2.1.3)
json (1.7.5, 1.5.4)
launchy (2.1.2)
libwebsocket (0.1.7.1, 0.1.6.1, 0.1.6)
linecache19 (0.5.13, 0.5.12)
listen (0.6.0, 0.5.3)
lumberjack (1.0.2)
mail (2.5.3, 2.5.2, 2.4.4, 2.3.3, 2.2.19)
method_source (0.8.1)
mime-types (1.19)
minitest (4.3.3, 4.3.2, 2.5.1)
multi_json (1.5.0, 1.4.0, 1.3.7, 1.2.0)
netrc (0.7.7)
nokogiri (1.5.5 x86-mingw32)
pg (0.14.1 x86-mingw32, 0.12.2 x86-mingw32)
polyglot (0.3.3)
pry (0.9.10 i386-mingw32)
rack (1.4.1, 1.3.6, 1.2.5)
rack-cache (1.2)
rack-mount (0.8.3, 0.6.14)
rack-ssl (1.3.2)
rack-test (0.6.2, 0.5.7)
rails (3.2.9, 3.0.12, 3.0.1)
railties (3.2.9, 3.2.7, 3.2.3, 3.1.8, 3.0.12, 3.0.1)
rake (10.0.3, 10.0.2, 10.0.1, 0.9.2.2)
rbx-require-relative (0.0.9)
rdiscount (1.6.8)
rdoc (3.12, 3.9.4)
RedCloth (4.2.9 x86-mingw32)
rest-client (1.6.7)
rspec (2.12.0, 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.12.0, 2.6.0)
rspec-mocks (2.12.0, 2.10.1, 2.9.0, 2.6.0)
rspec-rails (2.12.0, 2.6.1)
ruby-debug-base19x (0.11.30.pre10)
ruby-debug-ide (0.4.17.beta14)
ruby_core_source (0.1.5)
rubyzip (0.9.9)
sass (3.3.0.alpha.16, 3.2.4, 3.2.3)
sass-rails (3.2.5, 3.2.4, 3.1.6)
selenium-webdriver (2.27.1, 2.26.0)
slop (3.3.3)
spork (0.9.2, 0.9.0.rc8 x86-mingw32)
sprockets (2.8.1, 2.2.2, 2.2.1, 2.1.3, 2.0.4)
sqlite3 (1.3.6 x86-mingw32, 1.3.5 x86-mingw32, 1.3.4 x86-mingw32)
sqlite3-ruby (1.3.3)
sys-uname (0.9.0 x86-mingw32)
thor (0.16.0, 0.14.6)
tilt (1.3.3)
treetop (1.4.12)
tzinfo (0.3.35)
uglifier (1.3.0, 1.2.3)
webrat (0.7.3, 0.7.1)
websocket (1.0.4, 1.0.3, 1.0.2)
will_paginate (3.0.3, 3.0.pre2)
win32-process (0.7.0)
win32console (1.3.2 x86-mingw32)
xpath (1.0.0, 0.1.4)
ZenTest (4.8.3, 4.8.2)
c:\Users\Bob\RubymineProjects\beginruby>irb
irb(main):001:0> gem 'ibm_db'
=> true
rb(main):002:0> require 'ibm_db'
LoadError: 126: The specified module could not be found. - C:/Ruby193/lib/ruby
/gems/1.9.1/gems/ibm_db-2.5.11-x86-mingw32/lib/mswin32/rb19x/ibm_db.so
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:i
n `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:i
n `rescue in require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:i
n `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.11-x86-mingw32/lib/m
swin32/ibm_db.rb:1:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:i
n `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:i
n `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.11-x86-mingw32/lib/i
bm_db.rb:1:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:i
n `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:i
n `require'
from (irb):2
from C:/Ruby193/bin/irb:12:in `<main>'
irb(main):003:0>
最佳答案
放入IRB控制台(Windows):
require 'mswin32/ibm_db'
conn = IBM_DB::connect("DATABASE","db2admin","password")
当然,您可以使用irb中的此连接执行任何操作,以测试您的ibm_db gem,例如它是否正常工作。
关于database - 找不到要求ibm_db指定的模块,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14009143/