Skip to content

Access a table from an MDB file via ODBC

Install the ODBC client driver for kdb+. Install Microsoft ODBC driver for Microsoft Access.

Using the driver installed, a MDB file can be opened using the following example command:

q)h:.odbc.open "driver=Microsoft Access Driver (*.mdb, *.accdb);dbq=C:\\mydb.mdb"

The name of the driver may differ between versions. The command above should be altered to reflect the driver name installed.

Use .odbc.tables to list the tables.

q).odbc.tables  h
`aa`bb`cc`dd`ii`nn

Use .odbc.eval to evaluate SQL commands via ODBC.

q).odbc.eval[h;"select * from aa"]

An alternative to querying through SQL is to load the entire database into kdb+ via the .odbc.load command, where the data can then be queried using kdb+ directly.