Connect to Microsoft Access Database (FireDAC)
Go Up to Database Connectivity (FireDAC)
This topic describes how to connect to Microsoft Access database files.
Contents
Supported Versions
The FireDAC native driver supports the Microsoft Access 95, 97, 2000, 2003, 2007, and 2010 databases.
Windows Client Software
FireDAC requires one of the Microsoft Access x86 or x64 ODBC drivers to be installed on the workstation:
- "Microsoft Access Driver (*.mdb)" x86 ODBC driver version 3 or later (often referred to as the Microsoft JET ODBC Driver) for 95-2003 databases. See details. You can also use one of the alternative drivers provided for non-English languages.
- "Microsoft Access Driver (*.mdb, *.accdb)" x86 and x64 ODBC driver version 12 or later for 95-2010 databases. See details.
Note: To install an x86 or x64 Microsoft Access runtime on a workstation with an already installed runtime with a different architecture, specify "/passive" in the runtime installer command line. Because Delphi IDE is an x86 application, you should install the x86 Access version on your development workstation.
If the Microsoft Access ODBC driver has not been installed properly, an exception is raised when you try to connect:
If you try to open a DB created with a newer Access version using an older Access driver, an exception is raised:
macOS and iOS client software
FireDAC does not support Microsoft Access database connection on Linux, macOS, and iOS.
Driver Linkage
To link the driver:
- drop a TFDPhysMSAccessDriverLink component from the "FireDAC Links" component palette page
- or include the FireDAC.Phys.MSAcc unit in the uses clause.
Connection Definition Parameters
To connect to a Microsoft Access database, most applications require that you specify DriverID and Database (see Defining Connection (FireDAC) for details).
Note: FireDAC supports the password protected databases, but the password length must be equal to or less than 14 characters. With a longer password, an application raises the "Not a valid password" exception.
DriverID=MSAcc
Parameter | Description | Example value |
---|---|---|
Database |
The path to the MDB file. A path may include path variables. |
c:\mydb.mdb |
SystemDB |
The path to the system database file. A path may include path variables. |
c:\mysystem.mdb |
ReadOnly | Specify True to open a database in read-only mode. False is the default value. | True |
StringFormat |
Defines how to represent String values:
|
Unicode |
ODBCAdvanced | Allows you to specify any other additional ODBC connection parameter value. The default value is "ExtendedAnsiSQL=1". | IMPLICITCOMMITSYNC=NO |
Use Cases
- Open the Microsoft Access database.
DriverID=MSAcc Database=c:\mydata.mdb
- Open the Microsoft Access database using the system database.
DriverID=MSAcc Database=c:\mydata.mdb SystemDB=c:\system.mdb User_Name=usr Password=pwd
- Open the Microsoft Access password protected database. Note that the password length must be equal to or less than 14 characters.
DriverID=MSAcc Database=c:\mydata.mdb Password=pwd
Note: to drop/create, encrypt, compact, and repair the database use the TADMSAccessUtility component.
See Also
- Common Connection Parameters
- FAQs
- How to configure FireDAC Drivers
- How to manage FireDAC Connection Definitions
Samples
- FireDAC MS Access sample