Using ms access 97 as local db backend for rails on windows

Hi,

I am on a windows 2000 machine and want to use an ms access 97
database (*.mdb) as db backend.

I did a clean install: ruby, gems, rails, odbc-rails. A test rails
application connecting to a local mysql server is doing fine. I can
also locally connect to the odbc connection “local_odbc_name” with the
aqua data studio client.

But now with rails. As soon as I change the adapter to odbc webrick
won’t start.

I added
require ‘odbc_adapter’
to environment.rb like I understood from the documentation of the odbc-
rails gem.

I changed the development section in database.yml to:

development:
adapter: odbc
database: local_odbc_name
host: localhost

This is the error message I get when I want to start webrick:

c:\temp\test1>ruby script/server
=> Booting WEBrick…

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
connection_

adapters/abstract/connection_specification.rb:34: uninitialized class
variable @@allow_concurrency in ActiveRecord::Base (NameError)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in gem_original_require' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 27:inrequire’
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/
active_support/dependencies.rb:495:in require' from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/ active_support/dependencies.rb:342:innew_constants_in’
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/
active_support/dependencies.rb:495:in require' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/ active_record/connection_adapters/abstract_adapter.rb:10 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 27:ingem_original_require’
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in require' ... 27 levels... from c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/commands/ server.rb:39 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 27:ingem_original_require’
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `require’
from script/server:3
c:\temp\test1>

Maybe someone had this before? I don’t have enough understanding of
the whole system to deal with it.

Adrian

Adrian Schmitt wrote:

Hi,

I am on a windows 2000 machine and want to use an ms access 97
database (*.mdb) as db backend.

Hey
There are no database adaptors for odbc.
Please and why would you want to use MS Access while there are more
powerful tools like mysql, postgres,SQLite and MS SQL server?

please refer to this page for supported adapters:

http://wiki.rubyonrails.com/rails/pages/DatabaseDrivers

rgds
Tanzanite

On 06/03/07, Tanzanite T. [email protected]
wrote:

Adrian Schmitt wrote:

Hi,

I am on a windows 2000 machine and want to use an ms access 97
database (*.mdb) as db backend.

Hey
There are no database adaptors for odbc.

That’s not strictly true, as the SQL Server adapter does allow ODBC
connections (set mode to ODBC). I very much doubt it would work with
Access though.

Tom

There are no database adaptors for odbc.

I am a little confused by the above statement. If you look at the Rails
ODBC Adapter (Open Link)it has several drivers installed with it (mySQL,
PostgreQL, etc). From what I can tell this is supposed to be used with
the Ruby ODBC libs (Christian Werners).

This combination of code sounds like it is supposed to give ODBC support
with the same kind of Adapter behavior as a native db driver and adapter
would.

Now the bad news…I also cannot get them to run when trying to use ODBC
connecting through a mySQL DSN.

Here is the project link with all the info
http://odbc-rails.rubyforge.org/

Is my interpretation of operation correct? If so, any Help is greatly
appreciated.

My cry out for help on this board also:

http://www.ruby-forum.com/topic/100119#new

Thanks,
Rick

On 6 Mrz., 04:10, Tanzanite T. <rails-mailing-l…@andreas-
s.net> wrote:

There are no database adaptors for odbc.
I am not really sure.

Please and why would you want to use MS Access while there are more
powerful tools like mysql, postgres,SQLite and MS SQL server?

It is not the question to “use” this database. It is already there and
in use
by a number of applications in the environment.

The question is if I will be able to construct an additional easy
user interface for some of the data in that database with ruby on
rails
or not. If not I will have to use something else.

Of course it is nice to start a new project and choose whatever
components
you desire but sadly this is not possible in my case.

Thanks for the link to db adapters!

Cheers
Adrian

On 6 Mrz., 13:47, Rick F. [email protected]
wrote:

Here is the project link with all the infohttp://odbc-rails.rubyforge.org/

Thanks,
Rick

Thank you Rick, following your link I found great documentation and I
believe now that
I will also have to install the ODBC Binding for Ruby (http://ch-
werner.de/rubyodbc/)

I will do this as soon as my time permits, maybe it helps.

Cheers
Adrian

Adrian,

Please be aware that the odbc-rails adapter doesn’t currently support
MS Access. The adapter isn’t completely generic in that the adapter
requires some database-specific information which ODBC cannot provide.
Consequently, the adapter contains specific entries for each database
currently supported. However, it’s straightforward to modify the
adapter to support a new database for which an ODBC driver exists.
Alternatively, you could export your Access tables to one of the
supported databases.

If you were to do this, your database.yml file should contain
something similar to:

development:
adapter: odbc
dsn: local_odbc_name
username: rails_dev
password: rails_dev
emulate_booleans: true
trace: false

i.e. dsn refers to a Data Source Name configured with your ODBC
Administrator.

Regards
Carl Blakeley