Open MDB file on Ubuntu, convert it to CSV, import it to Rails
MDB is a data file format used by Microsoft Office Access. To open and view MDB files on ubuntu, you can install a tools named mdbtools :
sudo apt-get install libmdbtools mdbtools mdbtools-gmdb
This will also install MDB viewer, and you can use it to open and view MDB files. It also can be used to export tables to CSV(Comma-separated_values) files.
And here is an example importing CSV data into Rails model:
CSV::Reader.parse(File.open(‘/path/to/file’, ‘rb’)).each do |row|
Production.create(:name => row,
:price => row)