[fpc-pascal] Reading MDB (MS-Access) data under Linux
Michael Van Canneyt
michael at freepascal.org
Mon Nov 1 13:00:23 CET 2010
On Mon, 1 Nov 2010, Graeme Geldenhuys wrote:
> I need to write a data conversion app. Has anybody read MDB data under
> Linux yet, using SqlDB? I saw there was a ODBC database component, and
> searched by Ubuntu repository. I installed 'iodbc', 'libiodbc2' and
> 'libiodbc2-dev'. The 'iodbc' package came with a GTK ODBC Admin app, but
> I have no clue how ODBC works.
This is not enough. You must install a ODBC driver for access database.
The MDBTools contain one; install "libmdbodbc" (it will install other mdb tools).
You must make a DSN in the ODBC configuration that defines your database.
Install unixodbc-bin and run the (graphical) odbcconfig tool.
It's pretty straightforward from then on.
> * Anybody that can confirm that I can read MDB files via SqlDB's ODBC
On windows it can.
> * Any pointers and URL's on how to setup ODBC under Linux (Ubuntu)?
There is little to set up:
Set up the DSN, and point the TODBCConnection to the DSN you set up.
Then run your query.
But be careful, the mdb tools SQL abilities are rather limited.
Don't expect to be able to run just about any SQL query.
If you just need SELECT * FROM TABLE, then that should work fine.
More information about the fpc-pascal