This article provides a brief overview of the Microsoft Access data access provider for UniDAC used to establish a connection to Access databases from Delphi and Lazarus. You will find the description of some useful features and how to get started quickly.
Access provider is based on the ODBC provider. It uses Microsoft Access ODBC driver to work with a database. Main features of the Access data access provider are:
The full list of the Access provider features can be found on the UniDAC features page.
Both Professional and Standard Editions of UniDAC include the Access provider. Express Edition of UniDAC does not include the Access provider.
To learn the supported versions of Microsoft Access, refer to the Compatibility section.
Applications that use the Access provider require Microsoft Data Access Components (MDAC) to be installed on the client computer. In the current versions of Microsoft Windows, since Windows 2000, MDAC is already included as a standard package.
When an application was built without runtime packages (Link with runtime packages set to False in Project Options), you do not need to deploy any BPL files with it. For more information, see Deployment.
Note that UniDAC Trial requires deployment of additional BPL files regardless of Link with runtime packages.
Option name | Description |
---|---|
Charset | Specifies the encoding for storing textual data in the database. The option is used for working with older Access formats (e.g., Access 97) that do not support Unicode. |
ColumnWiseBinding |
If set to True, the option enables Column-Wise Binding mode. The fefault value is False. Note: Row-Wise Binding mode is enabled by default. However, some ODBC drivers don't support this mode. In such case, set the ColumnWiseBinding option to True. |
ConnectionTimeout | The time to wait for a connection to open before raising an exception. |
Direct |
Allows accessing Microsoft Access databases directly or through the Microsoft Access ODBC Driver. The following values are supported: False
Establishes the connection to Microsoft Access databases directly via the ODBC Driver.
True
Allows accesing Microsoft Access databases without using the ODBC Driver.
The default value is False.
|
DriverVersion |
Use the DriverVersion property to specify the version of Microsoft Access Driver (*.mdb, *.accdb). The following values are supported: dvAuto
The code first tests for the presence of *.accdb driver - if it is not found, *.mdb will be used.
dvAccdb
Specifies that *.accdb driver will be used.
dvMdb
Specifies that *.mdb driver will be used.
The default value is dvAuto.
|
ExclusiveLock | If True, a database will be opened in the Exclusive mode and can be accessed by only one user at a time. Performance is enhanced when running in the Exclusive mode. |
ExtendedAnsiSQL |
If True, an extended SQL support is enabled. Two new data types are available in Jet 4.0 databases when the ExtendedAnsiSQL flag is turned on: SQL_DECIMAL and SQL_NUMERIC. The default precision and scale are 18 and 0, respectively. Data accessed via ODBC that is typed as SQL_DECIMAL or SQL_NUMERIC will be mapped to Microsoft Jet Decimal instead of Currency. When the ExtendedAnsiSQL flag is turned off, you cannot create tables with decimal or numeric types, and these types will not appear in SQLGetTypeInfo(). However, if the table contains the new data types, they can be used with the correct data types. |
ForceCreateDatabase | Is used to force TLiteConnection to create a new database before opening a connection, if the database does not exist. |
ReadOnly |
Allows implementing a read-only multi-user mode to enable several users to read data from a Microsoft Access database simultaneously. The following values are supported: False
Keeps a single-user mode.
True
Allows two or more users to access the database simultaneously, however only in the ReadOnly mode.
The default value is False.
|
SystemDatabase | The full path to the Microsoft Access system database to be used with the Microsoft Access database you want to access. |
UseUnicode | Enables or disables Unicode support. Affects character data fetched from the server. When set to True, all character data is stored as WideStrings, and TStringField is replaced by TWideStringFiled. |
Option name | Description |
---|---|
CommandTimeout | The time to wait for a statement to be executed. |
Option name | Description |
---|---|
CommandTimeout | The time to wait for a statement to be executed. |
ExtendedFieldsInfo | If True, an additional query is performed to get information about returned fields and tables they belong to. The default value is True. |
FetchAll |
If True, all records of a query are requested from database server when the dataset is being opened. If False, records are retrieved when a data-aware component or a program requests it. The default value is False. |
The TUniScript component has no Access-specific options.
The TUniLoader component has no Access-specific options.
The TUniDump component has no Access-specific options.
Direct connection enables users to connect to Microsoft Access databases directly, without the need for Microsoft Access to be installed on their machine.
The following table lists the constants for mapping Access data types to Delphi data types. See Data Type Mapping for more information.
Constant | Description |
---|---|
accText | Maps Short Text to Delphi data types. |
accLongText | Maps Long Text to Delphi data types. |
accByte | Maps Byte to Delphi data types. |
accInteger | Maps Integer to Delphi data types. |
accLong | Maps Long to Delphi data types. |
accSingle | Maps Single to Delphi data types. |
accDouble | Maps Double to Delphi data types. |
accNumeric | Maps Numeric to Delphi data types. |
accDateTime | Maps Date/Time to Delphi data types. |
accBit | Maps Bit to Delphi data types. |
accBinary | Maps Binary to Delphi data types. |
accVarBinary | Maps VarBinary to Delphi data types. |
accLongBinaryLong Binary | Maps to Delphi data types. |