Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Learn How To Migrate dbExpress To FireDAC With The reFind Tool In This Delphi Sample

This sample project demonstrates how to migrate the project MeetingOrganizer from dbExpress to FireDAC using the reFind.exe tool.

Location

You can find the DBX2FDMigration project at:

How to Use the Sample

To use this sample project

  1. Run the migrate.bat utility.
  2. Create the new FireDAC connection definition.
  3. Add some additional components to your application form.
  4. Set up the FireDAC connection parameters.
  5. Run this demo application.

The following sections detail the steps of this procedure.

Run Migrate.bat Utility

The migrate.bat utility is located in the C:UsersPublicDocumentsEmbarcaderoStudio21.0SamplesObject PascalDatabaseFireDACToolreFindDBX2FDMigrationDemo folder.

The migrate.bat utility creates a new subdirectory FireDAC_MeetingOrg under Forms, and copies the source files of your dbExpress application to the FireDAC_MeetingOrg folder. It keeps the original source files.

The utility runs the RAD Studio reFind tool in order to replace the dbExpress terms of the application with their FireDAC counterparts.

Example of reFind.exe usage:

[crayon-67680f17cad07826592778/]

You can find the “reFind.exe” utility in “C:Program Files (x86)EmbarcaderoStudio21.0binreFind.exe“.

To run Migrate.bat:

  1. Go to C:UsersPublicDocumentsEmbarcaderoStudio21.0SamplesObject PascalDatabaseFireDACToolreFindDBX2FDMigrationDemo folder.
  2. Double-click the migration.bat application to start the migration process.

Creating the new FireDAC Connection Definition

  1. Open the project MeetingOrganizer.dproj located at C:UsersPublicDocumentsEmbarcaderoStudio21.0SamplesObject PascalDatabaseFireDACToolreFindDBX2FDMigrationDemoFormsFireDAC_MeetingOrg
  2. Create a FireDAC connection definition using the FireDAC Explorer.
    1. Go to Tools > FireDAC Explorer.SYSDBA
    2. In the FireDAC Explorer tool, go to File > New > Connection Definition.
    3. Setup the connection definition parameters.

This is the simplest connection definition for the MeetingOrganizer application:

[crayon-67680f17cad0e262569342/]

You can find the configuration file in C:UsersPublicDocumentsEmbarcaderoStudioFireDACFDConnectionDefs.ini

Adding some Components to Your Application Form

You need to add the following components to your application form:

Setting Up the FireDAC Connection Parameters

  1. In the Structure view, select FDConnection1.
  2. In the Object Inspector, specify the following parameters:
    1. Fill the ConnectionDefName property with the name of the connection defined using the FireDAC Explorer.
    2. Use the Params property to define the path to the database.

In the Code Editor, comment the part that is pointing to the dbxconnections.ini file:

[crayon-67680f17cad12689756558/]

Running This Demo Application

  1. Press F9 or choose Run > Run.
  2. When prompted, type in the User Login and the Passwordborlandborland.

Please refer to the link below for more information:

http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FireDAC.DBX2FDMigration_Demo_Sample

Head over and check out the full source code for the dbExpress to FireDAC migration sample on Embarcadero’s GitHub.

Exit mobile version