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

On Feb 19, 2008 2:03 PM, PAZAZ [email protected] wrote:

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.


Wayne M.
[email protected]

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?

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.


Phlip

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

On Feb 19, 2008 2:20 PM, PAZAZ [email protected] wrote:

Wayne M.
[email protected]


Wayne M.
[email protected]

  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

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.

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

On Feb 19, 2008 3:38 PM, PAZAZ [email protected] wrote:

RunTime Error. How do I fix this?

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.


Phlip


Wayne M.
[email protected]

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.

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’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)…

  1. 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.

On Feb 20, 2008, at 9:50 AM, PAZAZ wrote:

  1. I also have a non-Access question that I am putting here so I
    don’t
    have to start another thread.

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

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?

On 20 Feb 2008, at 17:50, PAZAZ wrote:

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

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

well… yes.

Although I agree wholeheartedly with all arguments against using
MSAccess as a database, some legacy systems do so, and require either
exporting or interfacing with.

I haven’t upgraded to Rails 2.0 yet, which puts ActiveRecord adapters in
gems, but I have an msaccess_adapter written that’s done me fine for
about a year now.

Microsoft Access adapter:

It most likely won’t work with the newest version of ActiveRecord, but
it works fine with previous versions (before adapters were moved to
gems).

Again, by all means DON’T use Access for your website database. Even
sqlite would be better. If you must tie in with an Access database,
don’t be afraid to use that for the data it has and must remain in the
access db, while keeping a mysql or sqlite db beside it for the regular
website operations. Among other things are huge speed and stability
differences.