UniDAC

Using DB2 data access provider with UniDAC in Delphi

This article provides a brief overview of the DB2 data access provider for UniDAC used to establish a connection to DB2 databases from Delphi and Lazarus. You will find the description of some useful features and how to get started quickly.

Overview

DB2 provider is based on the ODBC provider. It uses DB2 ODBC driver to work with a database. Main features of the DB2 data access provider are:

The full list of the DB2 provider features can be found on the UniDAC features page.

Both Professional and Standard Editions of UniDAC include the DB2 provider. Express Edition of UniDAC does not include the DB2 provider.

Compatibility

To learn about DB2 database server compatibility, refer to the Compatibility section.

Requirements

Applications that use the DB2 provider require the following components to be installed on the client computer:

Deployment

To deploy Win32 applications built with run-time packages, it is required to deploy the db2providerXX.bpl and odbcproviderXX.bpl files.

For more information about deployment of the UniDAC-based applications, please, refer to the common Deployment topic.

DB2-specific options

TUniConnection

Option name Description
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.
FunctionPath Use the FunctionPath property to change the current function path of the connection to the specified value. You can specify several names separated by comma. This option can be used to call stored procedures from a schema other than that of the current user without having to qualify the objects with the schema name.
Schema Use the Schema property to change the current schema of the connection to the specified schema. This setting offers a convenient way to perform operations on objects in a schema other than that of the current user without having to qualify the objects with the schema name.
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.

TUniSQL

Option name Description
CommandTimeout The time to wait for a statement to be executed.

TUniQuery, TUniTable, TUniStoredProc

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.
KeySequence Use the KeySequence property to specify the name of the sequence that will be used to fill in a key field after a new record is inserted or posted to the database.
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.
SequenceMode Set the SequenceMode property to specify which method is used internally to generate sequenced field.
The following values are allowed for this property:

smInsert
New record is inserted into the dataset with the first key field populated with a sequenced value. Application may modify this field before posting the record to the database.
smPost
Database server populates the key field with a sequenced value when application posts the record to the database. Any value put into the key field before post will be overwritten.

TUniScript

The TUniDump component has no DB2-specific options.

TUniLoader

The TUniLoader component has no DB2-specific options.

TUniDump

The TUniDump component has no DB2-specific options.

© 1997-2020 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback