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

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,199
Credits
4,009
Learn How To Migrate dbExpress To FireDAC With The reFind Tool In This Delphi Sample
February 7, 2021 by Konstantin Tomov

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 Pascal\Database\FireDAC\Tool\reFind\DBX2FDMigration\Demo\Forms
  • Subversion Repository:
    • You can find Delphi code samples in Для просмотра ссылки Войди или Зарегистрируйся. Search by name into the samples repositories according to your RAD Studio version.
1612710198579.png

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 Для просмотра ссылки Войди или Зарегистрируйся tool in order to Для просмотра ссылки Войди или Зарегистрируйся of the application with their FireDAC counterparts.

Example of reFind.exe usage:
Код:
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)\EmbarcaderoStudio\21.0\bin\reFind.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 Для просмотра ссылки Войди или Зарегистрируйся using the Для просмотра ссылки Войди или Зарегистрируйся.
    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:
Код:
 [MO]
Database=C:\Users\Public\Documents\EmbarcaderoStudio\16.0\Samples\Object Pascal\Database\FireDAC\Tool\reFind\DBX2FDMigration\Demo\Database\MEETINGORGANIZER.GDB
User_Name=SYSDBA
Server=127.0.0.1
DriverID=IB
Password=masterkey
You can find the configuration file in C:\Users\Public\Documents\Embarcadero\Studio\FireDAC\FDConnectionDefs.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 Для просмотра ссылки Войди или Зарегистрируйся, specify the following parameters:
    1. Fill the Для просмотра ссылки Войди или Зарегистрируйся property with the name of the connection defined using the FireDAC Explorer.
    2. Use the Для просмотра ссылки Войди или Зарегистрируйся property to define the path to the database.
In the Для просмотра ссылки Войди или Зарегистрируйся, comment the part that is pointing to the dbxconnections.ini file:
Код:
procedure TMainDM.SQLConnectionBeforeConnect(Sender: TObject);
begin
//  SQLConnection.LoadParamsFromIniFile
//    (IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName)) +
//    'dbxconnections.ini');
end;

Running This Demo Application​

  1. Press F9 or choose Run > Run.
  2. When prompted, type in the User Login and the Password: borland, borland.
Please refer to the link below for more information:
Для просмотра ссылки Войди или Зарегистрируйся
Для просмотра ссылки Войди или Зарегистрируйся