Forum: Ruby on Rails Using ms access 97 as local db backend for rails on windows

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
22265d224f74c1122f0e240d5654687a?d=identicon&s=25 Adrian Schmitt (Guest)
on 2007-03-05 22:57
(Received via mailing list)
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:in `require'
        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:in `new_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:in `gem_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:in `gem_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
D9e14f1be0972ff1f393cc87dbd072e1?d=identicon&s=25 George George (tanzanite)
on 2007-03-06 04:10
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
2f46d76f0e5db4dc318b03be07ebaac4?d=identicon&s=25 Tom Ward (Guest)
on 2007-03-06 09:31
(Received via mailing list)
On 06/03/07, Tanzanite Tanzanite <rails-mailing-list@andreas-s.net>
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
903de3fe51f14392609e28e82e1b1c6c?d=identicon&s=25 Rick Fiorentino (rickf)
on 2007-03-06 13:47
> 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
22265d224f74c1122f0e240d5654687a?d=identicon&s=25 Adrian Schmitt (Guest)
on 2007-03-06 21:29
(Received via mailing list)
On 6 Mrz., 13:47, Rick Fiorentino <rails-mailing-l...@andreas-s.net>
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
22265d224f74c1122f0e240d5654687a?d=identicon&s=25 Adrian Schmitt (Guest)
on 2007-03-06 21:32
(Received via mailing list)
On 6 Mrz., 04:10, Tanzanite Tanzanite <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
Ed1715615ad502bb555a2200a61caa62?d=identicon&s=25 cms (Guest)
on 2007-03-07 11:34
(Received via mailing list)
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
This topic is locked and can not be replied to.