Adapters are actual ActiveRecord adapters. There's no msaccess adapter
available, although there is a SqlServer adapter.

If you can get the connection going through ODBC, you could probably write
your own msaccess adapter - they're not that hard to write and you could use
the sqlite3 adapter as a template.

I've never successfully gotten a Rails app to talk to MS Access and I've
been at this a long long time. My recommendation is to convert the access db
to mysql or sqlserver and go from there. (We used to do ASP pages with MS
Access - let me just say that web apps + ms access == recipe for disaster.)

On Wed, Nov 10, 2010 at 12:30 PM, sullivan.t <[email protected]> wrote:

> 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
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to