# Export Data from Microsoft Access database

**URL:** <https://www.ruby-forum.com/t/export-data-from-microsoft-access-database/99610>\
**Category:** Ruby\
**Created:** [July 24, 2006, 2:39pm UTC](https://www.ruby-forum.com/t/export-data-from-microsoft-access-database/99610 "2006-07-24T14:39:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jatinder\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a88e4f/32.png) [@Jatinder\_S](https://www.ruby-forum.com/u/Jatinder_S)\
**Post date:** [July 24, 2006, 2:39pm UTC](https://www.ruby-forum.com/t/export-data-from-microsoft-access-database/99610/1 "2006-07-24T14:39:00Z")

</div>

How could I leverage Ruby to export mdb tables definations, data, forms,  
queries and then be able to import it in to some other dbms like  
oracle/db2  
etc?

Regards,  
Jatinder

---

<div class="post-metadata">

**Author:** ![Jatinder\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a88e4f/32.png) [@Jatinder\_S](https://www.ruby-forum.com/u/Jatinder_S)\
**Post date:** [July 24, 2006, 3:35pm UTC](https://www.ruby-forum.com/t/export-data-from-microsoft-access-database/99610/2 "2006-07-24T15:35:51Z")

</div>

Jatinder S. wrote:

> How could I leverage Ruby to export mdb tables definations, data, forms,  
> queries and then be able to import it in to some other dbms like  
> oracle/db2  
> etc?
> 
> Regards,  
> Jatinder

On WIndows, there is ODBC, of course, and there’s an “Access engine”  
that has part of the functionality of the real thing. If you have an  
Access license, there’s OLE/DCOM.

On Linux, try unixODBC or mdbtools  
([MDB Tools download | SourceForge.net](http://sourceforge.net/projects/mdbtools/)). I’m not sure if any of  
these (other than OLE/DCOM) are accessible directly from Ruby yet.

---

<div class="post-metadata">

**Author:** ![Jatinder\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a88e4f/32.png) [@Jatinder\_S](https://www.ruby-forum.com/u/Jatinder_S)\
**Post date:** [July 24, 2006, 3:53pm UTC](https://www.ruby-forum.com/t/export-data-from-microsoft-access-database/99610/3 "2006-07-24T15:53:26Z")

</div>

On 7/24/06, M. Edward (Ed) Borasky [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> that has part of the functionality of the real thing. If you have an  
> Access license, there’s OLE/DCOM.
> 
> On Linux, try unixODBC or mdbtools  
> ([MDB Tools download | SourceForge.net](http://sourceforge.net/projects/mdbtools/)). I’m not sure if any of  
> these (other than OLE/DCOM) are accessible directly from Ruby yet.

I did some work using Ruby and Access. I wrote some of my findings on  
RubyGarden:  
[http://wiki.rubygarden.org/Ruby/page/show/ScriptingAccess](http://wiki.rubygarden.org/Ruby/page/show/ScriptingAccess)

Les

---

<div class="post-metadata">

**Author:** ![Jatinder\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a88e4f/32.png) [@Jatinder\_S](https://www.ruby-forum.com/u/Jatinder_S)\
**Post date:** [July 24, 2006, 5:31pm UTC](https://www.ruby-forum.com/t/export-data-from-microsoft-access-database/99610/4 "2006-07-24T17:31:48Z")

</div>

On 7/24/06, Jatinder S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How could I leverage Ruby to export mdb tables definations, data, forms,  
> queries and then be able to import it in to some other dbms like oracle/db2  
> etc?
> 
> Regards,  
> Jatinder

Not ruby, but there is a collection of great little command line tools  
for exporting access databases. [http://mdbtools.sourceforge.net/](http://mdbtools.sourceforge.net/).

---

<div class="post-metadata">

**Author:** ![Jatinder\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a88e4f/32.png) [@Jatinder\_S](https://www.ruby-forum.com/u/Jatinder_S)\
**Post date:** [July 24, 2006, 7:30pm UTC](https://www.ruby-forum.com/t/export-data-from-microsoft-access-database/99610/5 "2006-07-24T19:30:19Z")

</div>

Can I use mdbtools on Windows platform? the reason I am asking this is  
bcos  
I do not seem to get installation/configuration info of mdbtools info  
for  
Windows platform.  
Am I missing something here? could you please assist me if you have any  
info  
on the same.

Regards,  
Jatinder

---

<div class="post-metadata">

**Author:** ![Jatinder\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a88e4f/32.png) [@Jatinder\_S](https://www.ruby-forum.com/u/Jatinder_S)\
**Post date:** [July 25, 2006, 3:43am UTC](https://www.ruby-forum.com/t/export-data-from-microsoft-access-database/99610/6 "2006-07-25T03:43:48Z")

</div>

Jatinder S. wrote:

> > > Regards,  
> > > Jatinder
> > 
> > Not ruby, but there is a collection of great little command line tools  
> > for exporting access databases. [http://mdbtools.sourceforge.net/](http://mdbtools.sourceforge.net/).

If they’re open source, they might be compilable/executable in CygWin.  
But on a Windows system, you can probably do what you want using ODBC.  
Just create a dataset name pointing to you MDB file and issue ODBC  
queries. You might need some other Microsoft query utilities and you  
might have to construct SQL in your Ruby code; I don’t use Ruby on  
Windows so I don’t know if there’s an ODBC connection capability in  
Ruby.

---

<div class="post-metadata">

**Author:** ![Jatinder\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a88e4f/32.png) [@Jatinder\_S](https://www.ruby-forum.com/u/Jatinder_S)\
**Post date:** [July 25, 2006, 8:50am UTC](https://www.ruby-forum.com/t/export-data-from-microsoft-access-database/99610/7 "2006-07-25T08:50:27Z")

</div>

M. Edward (Ed) Borasky wrote:

> > Jatinder
> > 
> > > >
> 
> But on a Windows system, you can probably do what you want using ODBC.  
> Just create a dataset name pointing to you MDB file and issue ODBC  
> queries. You might need some other Microsoft query utilities and you  
> might have to construct SQL in your Ruby code; I don’t use Ruby on  
> Windows so I don’t know if there’s an ODBC connection capability in Ruby.

There is. I’ve used Ruby-ODBC for extracting from Access to MySQL  
before. Not in any particularly clever manner, mind you, but it  
works…

---

<div class="post-metadata">

**Author:** ![Jatinder\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a88e4f/32.png) [@Jatinder\_S](https://www.ruby-forum.com/u/Jatinder_S)\
**Post date:** [July 24, 2006, 5:08pm UTC](https://www.ruby-forum.com/t/export-data-from-microsoft-access-database/99610/8 "2006-07-24T17:08:23Z")

</div>

Leslie,

I came across your findings.  
I am wondering if this(migration of all access tables including  
relationships and data) has been achieved in other languages as well  
like  
Java,VBA, etc. and is still to be achieved in Ruby.  
I am looking at some library which could help me with mapping of  
datatypes  
and differences between Access and Oracle/DB2; I can do it from scratch  
but  
that would be my last option.

Regards,  
Jatinder
