问题
I'm running Ruby 2.6.3p62 32-bit on Windows 10 64-bit. I installed it using the Ruby Installer. I successfully installed the gem 'ibm_db' without any errors. I downloaded the DB2-clidriver from http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/nt32_odbc_cli.zip, unzipped it an set the environment variable IBM_DB_HOME to its location. In addition, I added IBM_DB_HOME\bin to the PATH variable. When requiring the ibm_db I get the following error:
C:\Users\myuser\Programs\Ruby26\bin>ruby -e "require 'ibm_db'"
Traceback (most recent call last):
2: from -e:1:in `<main>'
1: from C:/Users/myuser/Programs/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/Users/myuser/Programs/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- ibm_db (LoadError)
9: from -e:1:in `<main>'
8: from C:/Users/myuser/Programs/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
7: from C:/Users/myuser/Programs/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
6: from C:/Users/myuser/Programs/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
5: from C:/Users/myuser/Programs/Ruby26/lib/ruby/gems/2.6.0/gems/ibm_db-4.0.0-x86-mingw32/lib/ibm_db.rb:21:in `<top (required)>'
4: from C:/Users/myuser/Programs/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
3: from C:/Users/myuser/Programs/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
2: from C:/Users/myuser/Programs/Ruby26/lib/ruby/gems/2.6.0/gems/ibm_db-4.0.0-x86-mingw32/lib/mswin32/ibm_db.rb:90:in `<top (required)>'
1: from C:/Users/myuser/Programs/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/Users/myuser/Programs/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': 126: The specified module could not be found. - C:/Users/myuser/Programs/Ruby26/lib/ruby/gems/2.6.0/gems/ibm_db-4.0.0-x86-mingw32/lib/mswin32/rb2x/i386/ibm_db.so (LoadError)
The file mentioned in the last line
C:/Users/myuser/Programs/Ruby26/lib/ruby/gems/2.6.0/gems/ibm_db-4.0.0-x86-mingw32/lib/mswin32/rb2x/i386/ibm_db.so
does exist.
回答1:
Your question may be better suited to the Github issues page for the ibm_db gem, because your question concerns configuration and does not concern either Ruby programming , or programming for Db2.
In particular see: https://github.com/ibmdb/ruby-ibmdb/issues/83
It appears that the ibm_db gem may not yet support your version of Ruby on your operating-system platform, but it may support an older version of Ruby.
来源:https://stackoverflow.com/questions/56850201/how-to-fix-error-requiring-ibm-db-gem-on-windows