Getting Started With Access (on a non-MS platform)

Installation

MDB Tools provides a gui for browsing Microsoft Access database files, command line tools and a library for working with the tables directly, a library for running SQL queries and an ODBC driver which uses the SQL library. Currently, the SQL library, and consequently the ODBC driver, are very limited, you can only run SELECT queries and you cannot do joins.

To install MDB Tools, download it from the MDB Tools site and compile it. I usually give the configure script the --prefix=/usr/local/mdbtools parameter so that the entire MDB Tools suite will be installed under /usr/local/mdbtools, then I add /usr/local/mdbtools/bin to my PATH environment variable and /usr/local/mdbtools/lib to my LD_LIBRARY_PATH environment variable.

I have successfully built, installed and used MDB Tools 0.5 and 0.6pre1 on Linux, FreeBSD, NetBSD and OpenBSD.

To compile under gcc 4.0 or higher, you need to modify src/libmdb/backend.c and change line 31 from:

static GHashTable *mdb_backends;

to:

GHashTable *mdb_backends;

Some newer CVS versions of mdbtools have a bug where mdbtools.h contain the line:

#include <config.h>

But no config.h file is provided by the package. Comment out that line:

/*#include <config.h>*/

Not doing so will cause any software that you try to build against MDBTools to fail to compile, usually with a cryptic error regarding the number of parameters that some function has.

Creating a Database

For now, I honestly don't know how to create a database using MDB Tools. I haven't spent much time using the tools. You can probably create a database from a set of csv files using mdb-import, but that's really just a guess.

You can, of course create a database file using Microsoft Access. You can either store the database on a non-Windows server and provide Windows clients access to it using Samba or store the database on a Windows server and provide Linux clients access to it using an SMB mount.

Accessing a Database

To access a Microsoft Access database, su to a user that has access to the file and use any of the following MDB Tools to access it.

  • gmdb2
  • mdb-array
  • mdb-export
  • mdb-header
  • mdb-hexdump
  • mdb-import
  • mdb-parsecsv
  • mdb-prop
  • mdb-schema
  • mdb-sql
  • mdb-tables
  • mdb-ver
  • prcat
  • prdata
  • prdump
  • prindex
  • prkkd
  • prole
  • prtable
  • unittest
  • updrow

I honestly don't know what they all do or how to use them, but gmdb2 is a very nice graphical browser.