Ruby on Rails and MS Access

How do I connect an existing or new Access database with Ruby on
Rails?

I am new to Ruby on Rails and a tutorial I am going through mentions
using MySQL but I don't have MySQL and only work with MS Access.

Is MySQL available for free on the web? Thanks.

MySQL has a free Community Edition (there are licenses, but I believe the only apply if you’re redistributing the database, and your code isn’t open-source).

  • Wayne

Thanks. Where can I get the community edition?

I would prefer finding a way to connect ROR with MS Access so that if
a web application is built....I can take data from MS Access and put
it into ROR or vice versa. Any ideas? Would this be easier with
MySQL?

I don’t know if Rails can connect to Access, as I’ve never tried.

MySQL Community Edition: http://dev.mysql.com/downloads/mysql/5.0.html (select the “Download” link under MySQL Community Server)

Hope this helps.

  • Wayne

PAZAZ wrote:

Thanks. Where can I get the community edition?

Google is your friend!

And the "MySQL Community Edition" is all you need to serve. The payware version is essentially for when you sell an entire application, like on a CD or an appliance. MySQL is generally free if you just install and serve it.

I would prefer finding a way to connect ROR with MS Access so that if
a web application is built....I can take data from MS Access and put
it into ROR or vice versa. Any ideas? Would this be easier with
MySQL?

Google for [ado activerecord]. Access's database piping layer is called ADO.

1) I googled "ado activerecord" but it says on google that this is the
server adapter for MySql.

2) I also have a non-Access question that I am putting here so I don't
have to start another thread. I put in the followoing code ("Ruby
script/generate model book")
into the command line to create a model called book....but I get a
RunTime Error. How do I fix this?

Parakash

Actually I am finding some things related to ADO and Access .... but I
am not sure how to write code to link ADO (or an existing Access
database) with ROR?

You may have to use create a DSN for your access database and use ODBC:

http://odbc-rails.rubyforge.org/

If all you want is to have the database stored with the application
(like mydatabase.mdb) then just use SQLite, the default db with rails
2.0. It will store the file as mydatabase.sqlite. I like SQLite
Manager, the gui that comes as a firefox extension:

https://addons.mozilla.org/en-US/firefox/addon/5817

Hope that helps,
Abdullah

For your second question, what is the error you’re getting? That would help us narrow it down and offer suggestions on how to fix it :wink:

  • Wayne

I went ahead and downloaded the program from the first link below. I
don't use Firefox so i don't think the second link will be useful for
me. I am not that familiar with DSNs or OBDCs but will try to see what
I can do. Thanks.

PAZAZ wrote:

I would prefer finding a way to connect ROR with MS Access so that if
a web application is built....I can take data from MS Access and put
it into ROR or vice versa. Any ideas? Would this be easier with
MySQL?

Regarding MS Access, I'd say don't. The SQL engine in Access is
hobbled compared to MySQL,PostgrSQL,Oracle,...

Also, a friend and I have both seen larger Access databases have
serious stability issues.

I agree. It's really time for you to outgrow MS Access. Access is not
a server class database. Although you may be able to make it function
through ODBC, it's just not worth it in the long run. MySQL or
PostgreSQL are great free and open source solutions that will serve
you well. Invest the time to learn one or both of them. You won't
regret it.

I't been a long time since I've worked with ODBC, etc. (and I'm glad
about that to be honest), but I remember one thing MS had down right
was their db tools. I remember a somewhat sophisticated--and I dare
say intuitive--GUI to move all kinds of data around, from one source
to another.

I'd recommend building your schemas in Rails, using something like
MySQL--and then, after you've done your initial rake db:migrate,
connect to your MySQL db, via ODBC and import your data from Access
into mysql. Trust me, you'll be glad you spend the minimal hours
required to do this step.

-BK

Thanks for all the replies. The reason I am mentioning Access is b/c I
work in a medical department where we use only Access b/c we really
don't need the large data capabilities of MySQL and the databases were
created many years back in Access 2000, which serves our needs fine.

But since I am new to ROR and am interested in building my own
applications, I will look into MySQL.

For the question #2 below (which I am pasting below this line)....

2) I also have a non-Access question that I am putting here so I
don't
have to start another thread. I put in the followoing code ("Ruby
script/generate model book")
into the command line to create a model called book....but I get a
RunTime Error. How do I fix this?

...this is from a tutorial I am doing to learn ROR and the tutorial
says to create the model book with the one line code above....but when
I put this into the command interface I get a long RunTime Error.

More specifically (this is in reference to the error I am getting on
Question 2 above) the error I get says (("no such file to
load....active record/connection_adapters/access_adapter)RunTime
Error")

Not sure how to get past this?

I don’t mean to pick on you, but please start new threads so the subjects are easier to spot, sort, and Google. If it’s not about Access, it should not have Access in the subject.

It will really help the next person with the same question.

Thx

2) I also have a non-Access question that I am putting here so I
don't
have to start another thread. I put in the followoing code ("Ruby
script/generate model book")
into the command line to create a model called book....but I get a
RunTime Error. How do I fix this?

...this is from a tutorial I am doing to learn ROR and the tutorial
says to create the model book with the one line code above....but when
I put this into the command interface I get a long RunTime Error.

As others have said you really need to tell us exactly what the error
is. It's probably just a missing library or something, but without
seeing the error it's hard to say which library is missing.

Fred

caused by adapter: access in your database.yml, while no access
adapter available.
Simplest fix I can imagine is to use sqlite adapter along with sqlite
gem installed.

Can i use sqlite adapter or sqlite gem if I don't use firefox and only
use Windows?

well... yes.