From Exponential 6.0.15, exp:access:import copies the tables of a Microsoft Access file (.accdb or .mdb) into the site's database or into a data table connection. On Linux it reads the file with MDBTools, so Access itself is not needed; on Windows it uses Microsoft's Access ODBC driver.
Import
./console exp:access:import shop.accdb --list # the tables and their columns ./console exp:access:import shop.accdb --prefix=shop_ # the plan: nothing written ./console exp:access:import shop.accdb --prefix=shop_ --apply # make the tables, copy the rows
- --connection: site (the default) or a data table connection on MySQL or MariaDB, PostgreSQL, SQLite, SQL Server, Oracle or ODBC.
- --tables: only these tables. --prefix: put in front of every table name.
- --mode: create (new tables), append, or replace (delete the rows first).
- --reader: auto, mdbtools (Linux, macOS, BSD) or odbc (Windows).
- --apply: write. Without it the command shows the plan only.
Exit code 0 when every table and row arrived, 1 when a row failed (the failed rows are listed, the others are written), 2 for wrong options or a file that cannot be read.
What happens to names and types
Names become lower-case ASCII with underscores (Order Details becomes order_details), and an SQL keyword gets a trailing underscore. AutoNumber becomes the table's key, dates become text in Y-m-d H:i:s (Access keeps no time zone), and pictures and other binary data are kept as base64 text. Ids are copied as they are, and rows go in transactions of 500.
What you need
- Linux: the mdbtools package (apt install mdbtools, or dnf install mdbtools from EPEL), version 0.9 or newer.
- Windows: the Microsoft Access Database Engine 2016 Redistributable, x64 for a 64-bit PHP, and PHP's odbc and pdo_odbc extensions.
Note: Import, do not run on Access. Access is a file database for one desktop. A small Access driver exists for reading a file in place on Windows, but a site on Access is not supported.