AnyDAC
ContentsIndexHome
PreviousUpNext
Connect to Microsoft Access database

Describes how to connect to Microsoft Access database files.

Group
Links
Supported versions

The AnyDAC native driver supports the Microsoft Access 95, 97, 2000, 2003, 2007 and 2010 databases. 

 

Windows client software

AnyDAC 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 higher (often referred to as the Microsoft JET ODBC Driver) for 95-2003 databases. See details. You may 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 higher for 95-2010 databases. See details.

When the Microsoft Access ODBC driver has not been properly installed, you will get an exception when you try to connect: 

 

[AnyDAC][Phys][ODBC][Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.

 

When trying to open a DB created with a newer Access version using an older Access driver, you will get an exception: 

 

[AnyDAC][Phys][ODBC][Microsoft][ODBC Microsoft Access Driver] Cannot open database '(unknown)'.
It may not be a database that your application recognizes, or the file may be corrupt.

 

Linux and Mac OS X client software

AnyDAC does not support Microsoft Access database connection on Linux and Mac OS X. 

 

Driver linkage

To link the driver:

 

Connection definition parameters

To connect to a Microsoft Access database, most applications will need to specify DriverID and Database

Note, AnyDAC supports the password protected databases, but the password length must less or equal to 14 characters. With a more long password an application will raise "Not a valid password" exception. 

 

DriverID=MSAcc  

Parameter 
Description 
Example value 
Database 
The path to the MDB file. 
c:\mydb.mdb 
SystemDB 
The path to the system database file. 
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:
  • Choose - represent as ftString / ftMemo on non-Unicode Delphi (D2007 and lower) and ftWideString / ftWideMemo on Unicode Delphi (D2009 and higher) (default);
  • Unicode - always represent as ftWideString / ftWideMemo;
  • ANSI - always represent as ftString / ftMemo.
 
Unicode 
ODBCAdvanced 
Allows you to specify any other additional ODBC connection parameter value. The default value is "ExtendedAnsiSQL=1". 
IMPLICITCOMMITSYNC=NO 

 

Usage cases
  • Open 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, the password length must be less or equal to 14 characters.

 

DriverID=MSAcc
Database=c:\mydata.mdb
Password=pwd

 

Note: to drop/create, encrypt, compact and repair the database use TADMSAccessUtility component.

What do you think about this topic? Send feedback!