I'm connecting to Exasol using the dbi
and ruby-odbc
gems with unixodbc and it works fine, loaded like this:
require 'dbi'
require 'odbc_utf8'
When I add Bundler to the mix, ruby-odbc doesn't seem to be able to find the odbc configuration:
Could not load driver (undefined method `driver_name' for ODBC:Module)
/usr/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:318:in `rescue in load_driver'
/usr/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:242:in `load_driver'
/usr/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:160:in `_get_full_driver'
/usr/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:145:in `connect'
It doesn't matter if I require it via Bundler.require
(with gem 'ruby-odbc', require: 'odbc_utf8'
in the Gemfile) or with require 'bundler/setup'
and require 'odbc_utf8'
.
This is how I try to connect:
DBI.connect('DBI:ODBC:exa', config['username'], config['password'])
In case it matters, this is what my .odbc.ini
looks like:
[exa]
Driver = /opt/EXASolution_ODBC-4.0.8/lib32/libexaodbc-uo22.so
EXAHOST = 192.168.235.84..86:8563
edit: The way it works without Bundler only does so with Ruby 1.9.3. It looks to me like a scoping issue, as driver_name
is a variable passed as an argument to the method that raises the exception.