![2001767 | Embarcadero RAD Studio Delphi C++Builder Blogs](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/08/2001767-1.jpg?resize=1140%2C694&ssl=1)
This sample project demonstrates how to migrate the project MeetingOrganizer from dbExpress to FireDAC using the reFind.exe tool.
Table of Contents
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.
![MeetingOrg | Embarcadero RAD Studio Delphi C++Builder Blogs](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/11/MeetingOrg-3.png?resize=750%2C405&ssl=1)
How to Use the Sample
To use this sample project
- Run the migrate.bat utility.
- Create the new FireDAC connection definition.
- Add some additional components to your application form.
- Set up the FireDAC connection parameters.
- 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:
1 |
reFind.exe FireDAC_MeetingOrg*.pas FireDAC_MeetingOrg*.dfm FireDAC_MeetingOrg*.fmx /X:....FireDAC_Migrate_DBX.txt |
You can find the “reFind.exe” utility in “C:Program Files (x86)EmbarcaderoStudio21.0binreFind.exe
“.
To run Migrate.bat:
- Go to
C:UsersPublicDocumentsEmbarcaderoStudio21.0SamplesObject PascalDatabaseFireDACToolreFindDBX2FDMigrationDemo
folder. - Double-click the migration.bat application to start the migration process.
Creating the new FireDAC Connection Definition
- Open the project MeetingOrganizer.dproj located at
C:UsersPublicDocumentsEmbarcaderoStudio21.0SamplesObject PascalDatabaseFireDACToolreFindDBX2FDMigrationDemoFormsFireDAC_MeetingOrg
- Create a FireDAC connection definition using the FireDAC Explorer.
- Go to Tools > FireDAC Explorer.SYSDBA
- In the FireDAC Explorer tool, go to File > New > Connection Definition.
- Setup the connection definition parameters.
This is the simplest connection definition for the MeetingOrganizer application:
1 2 3 4 5 6 |
[MO] Database=C:UsersPublicDocumentsEmbarcaderoStudio16.0Samples<strong>Object</strong> PascalDatabaseFireDACToolreFindDBX2FDMigrationDemoDatabaseMEETINGORGANIZER.GDB User_Name=SYSDBA Server=127.0.0.1 DriverID=IB Password=masterkey |
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:
- A TFDGUIxWaitCursor component.
- A TFDConnection component.
Setting Up the FireDAC Connection Parameters
- In the Structure view, select FDConnection1.
- In the Object Inspector, specify the following parameters:
- Fill the ConnectionDefName property with the name of the connection defined using the FireDAC Explorer.
- 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:
1 2 3 4 5 6 |
<strong>procedure</strong> <strong>TMainDM</strong>.SQLConnectionBeforeConnect(Sender: TObject); <strong>begin</strong> <em>// SQLConnection.LoadParamsFromIniFile</em> <em>// (IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName)) +</em> <em>// 'dbxconnections.ini');</em> <strong>end</strong>; |
Running This Demo Application
- Press F9 or choose Run > Run.
- When prompted, type in the User Login and the Password: borland, borland.
Please refer to the link below for more information:
http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FireDAC.DBX2FDMigration_Demo_Sample
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition