Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
CodeDelphiRAD Studio

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:

  • Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to:
    • Object PascalDatabaseFireDACToolreFindDBX2FDMigrationDemoForms
  • Subversion Repository:
    • You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.

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:

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:

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:

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.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Related posts
C++CodeDatabaseDelphiRAD Studio

TCoffeeAndCode: Data Visualization – Components, Libraries, Tools and Services

DelphiShowcase

This Native High-Accuracy Walking Profiler Can Measure Reality

DelphiShowcase

Ultimate Hockey Playview Application Is Delphi Powered

CodeDelphiIDERAD Studio

How Easy Is It To Add A REST API To Your Own Apps?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES