Rails 4 ODBC Connection

Viewed 748

I've been using Ruby successfully to connect to an external IBM DB2 odbc database using a third-party driver. However, when I try to do the same thing in Rails, an error is thrown:

IM003 (160) Specified driver could not be loaded due to system error 182

I've tried these gems (odbc-rails uses development.rb, same result):

  • gem 'rails-dbi'
  • gem 'dbd-odbc'
  • gem 'ruby-odbc'
  • gem 'odbc-rails'

Here is the line of code that throws the error:

DBI.connect("DBI:ODBC:My_ODBC_Connection", username, password)

I can run this line of code at the Ruby console, but not at the Rails console with the same Ruby version. I am using Windows 8.1

I have given full permissions to the folder containing the library. Also tested running commands in administrative mode for the CLI.

I have looked up Rails guides to see if there was a security feature blocking the driver from being loaded in Rails and it seems the issue resides with Rails somewhere.

If anybody has any ideas, I would be very grateful.

0 Answers
Related