Migrating dbExpress Applications to FireDAC

From RAD Studio
Jump to: navigation, search

Go Up to Migrating to FireDAC

This article guides you through a series of steps of how to migrate a dbExpress application to FireDAC.

Topics

Topic Description
dbExpress Name Counterparts Many of the dbExpress high-level types and components have counterparts in FireDAC.
dbExpress Connection Migration Description of how to migrate dbExpress named connections to FireDAC connection definitions.
Additional dbExpress Migration Hints Few additional considerations on how to migrate a dbExpress application.
dbExpress Application Migration A step-by-step example showing how to migrate dbExpress application to FireDAC.

Introduction

This article provides a tutorial showing how to migrate a simple client-server application using dbExpress data access components, such as TSQLConnection, TSQLQuery, TSQLTable, to the FireDAC. It shows the basic principles of replacing the common components, properties and code, preserving the developers working time and avoiding the common migration pitfalls.

Overview

In general, FireDAC components have many differences with the dbExpress data access components. This includes the syntax and semantic of the properties and methods in the FireDAC and dbExpress. The main differences are:

General

  • dbExpress and FireDAC have components with different names. For example, TSQLQuery component in dbExpress is TFDQuery in FireDAC.
  • The base APIs (the Data.DBXCommon and the Phys interface) are incompatible. If you have some code that directly uses the Data.DBXXxx units, you have to code it again for FireDAC.

Drivers and TSQLConnection

  • dbExpress and FireDAC have different ways to specify DBMS client library.
    • dbExpress allows you to specify the DBMS client library in the connection parameters.
    • FireDAC uses the TDBPhysXxxDriverLink component.
  • Different connection parameters.
  • Different named connection, connection definition systems and connection parameters.
  • Different transaction control methods. FireDAC has similar methods, still with slightly different arguments and semantic.
  • Different tracing capabilities.

TSQLDataSet, TSQLQuery, TSQLStoredProc, and TSQLTable components

  • All dbExpress datasets are unidirectional. Combining dbExpress dataset with TDataSetProvider and TClientDataSet makes it bidirectional with advanced client side capabilities. FireDAC datasets are bidirectional with advanced client side capabilities.
  • dbExpress has TSQLDataSet which supports different dbExpress command types. FireDAC does not have similar component, and offers to use TFDQuery, TFDStoredProc, or TFDTable instead.
  • dbExpress and FireDAC may have different data type mapping for the same RDBMS. FireDAC follows a mapping style closely similar to the dbExpress data type mapping. For exceptions FireDAC has powerful capabilities to adjust the data type mapping.
  • dbExpress and FireDAC have different parameters binding mode.
    • dbExpress has binding by position.
    • FireDAC allows to choose between binding by name (default mode) and by position.

This is nearly all that needs to be considered and changed while migrating from dbExpress to FireDAC. After the migration (or in parallel with it), consider reviewing your application for:

  • Using the extended FireDAC functionality to simplify your application.
  • Using the extended FireDAC functionality to extend the functionality of your application.
  • Using the FireDAC options to fine-tune your application and speed it up.

See Also