Good afternoon,
I’ve had a hard time today trying to connect a rails app (still new to
it, overall, though I do have some sintra experience) to an existing
access mdb.
I’ve installed the ODBC binding for ruby from
http://www.ch-werner.de/rubyodbc/
I’ve also seen/used: http://odbc-rails.rubyforge.org/
I’ve tried the one-click installer for both ruby 1.8 and 1.9.x.
I’ve been able to connect via ODBC and IRB straight ruby to get a
simple select query going.
irb(main):001:0> require ‘DBI’
=> true
irb(main):002:0> conn = DBI.connect(‘DBI:ODBC:mdbtest’)
c:/ruby/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:93: warning:
already initial
ized constant VERSION
c:/ruby/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:96: warning:
already initial
ized constant API_VERSION
c:/ruby/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:100: warning:
already initia
lized constant DEFAULT_TRACE_MODE
c:/ruby/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:101: warning:
already initia
lized constant DEFAULT_TRACE_OUTPUT
=> #<DBI::DatabaseHandle:0x3335d60 @handle=#<DBI::DBD::ODBC::Database:
0x3335c88
@handle=#ODBC::Database:0x3335cb8, @attr={}>, @driver_name=“odbc”,
@convert_ty
pes=true, @trace_output=nil, @trace_mode=nil>
irb(main):003:0> conn.tables
=> [nil, nil, nil, nil, nil, nil, nil]
irb(main):004:0> conn.select_all(‘select * from employees’)
=> [[1, “thomas”, 31], [2, “bob”, 42]]
irb(main):006:0> quit
But I’m stumped in getting it to work with activerecord. If I have a
new rails app, and my database.yml looks like this:
development:
adapter: msaccess
mode: odbc
dsn: mdbtest
When I run a rake:db:migrate I get this:
(in C:/sandbox/skunk/mdb)
rake aborted!
Please install the msaccess adapter: gem install activerecord- msaccess-adapter
(no such file to load – active_record/connection_adapters/
msaccess_adapter)
(See full trace by running task with --trace)
I’ve even tried the 3+ year old version of the activerecord-msaccess-
adapter and put it into the vendor/… location stated. No go.
Current setup: Windows XP.
Ruby: ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
Rails: rails (2.3.4)
gem-v: 1.3.7
Thoughts?
What are people currently doing today?
Thank you for your time!
-Tom