Archive

Archive for the ‘MS Access’ Category

mdb – Getting data from Microsoft Access *.mdb files

February 1, 2013 Leave a comment

Problem:

I had to get data from a Microsoft Access database but I do not have MS Windows installed.

Solution:
What worked for me was mdb-export and mdb-tables which are both part of the mdbtools suite in linux.

I wrote a script to extract all the data.

#!/bin/bash

WDIR="/home/user/dumps"
DATABASE="database.mdb"
_date="$(date +'%F')"

cd $WDIR/

# Get the tables.
mdb-tables $DATABASE | tr ' ' '\n' > db-tables.csv

sed '/^$/d' db-tables.csv | \
while read table
do
    echo $table
    mdb-export $DATABASE $table > dumped_${table}_${_date}.csv
done 

# Clean up
rm db-tables.csv

Source:
http://mazamascience.com/WorkingWithData/?p=168