5-Minute-Snack: Migrating a Delphi XE4 Database Application to Delphi Tokyo… or: from AnyDAC/BDE to FireDAC

Just for the record, the 5 minute mark refers to the time you need to read and understand the content. The actual migration took me 30 minutes. 

Still, it is one of the major things that makes Delphi a very valuable product to me. A customer wanted me to make changes to an application that I wrote during the XE4 days. Just to be on the same page: 

That means I touched this code in mid-2013 for the last time. About 4 years ago!

Normally, I would install XE4 in another Virtual Machine and go from there. This time, however, as it was a database-heavy VCL desktop application to input data, I decided to assess the time-frame needed to migrate the application to the current version.

The application also used several TMS components. As I still use their component sets and they already offer everything for Tokyo, I was opimistic, but I still expected some issues.

So, after getting the HEAD revision out of my versioning control system, I opened the project in Delphi Tokyo. I selected Clean and Build to see how many problems I would have to fight in order to make a decision:

Well, I was quite surprised. One issue:

Oh, right. Back then FireDAC was already called FireDAC, but the units and components still carried the “AD” moniker from “AnyDAC”. 

Migrating FireDAC is the only thing to do. All TMS components worked out of the box!

Kudos to TMS. They always put reliability, longevity and compatibility first. Using their components paid off. 

However, the remaining issue got very visible when opening one of the data modules:

What now?

Entering “Migrating FireDAC AnyDAC docwiki embarcadero” into Google yielded this as a result: 

Perfect. Embarcadero provides tooling to do the migration.

Thus, I opened PowerShell and had a look at the mentioned “reFind” tool:

Excellent. Embarcadero provides several “Rule Files” that will make sure the migration will run smoothly. In my case, as I was using FireDAC as if it still were AnyDAC, I needed to go to

to find the rule sets I needed.

I then used the following two lines in my project directory to migrate the source code:

And that was it!

So the uses clauses that looked like this …

…have been migrated to this:

Note that all AD-refrences have been updated with FireDAC.

Furthermore, all component references have been updated. 

Before:

After:

These are just some issues that are being automatically resolved. Also changes to the components and enumeration types etc. are being migrated.

The next clean, build-cycle did yield a working solution already. 

A desktop-only VCL database application migrated from XE4 to Tokyo in less than an hour! And I even had to read the documentation, i.e. the actual process to execute the steps necessary was much faster!

Considering that I had desktop applications written in C# using Entity Framework or even Microsoft Lightswitch I was expecting much more of a hassle. Delphi has proven once again to be very much compatible with previous versions. When it comes to major changes, Embarcadero will provide proper tooling.

In case you still have a database application that relies on the BDE, there are also scripts available to convert all BDE components to FireDAC components. There will be more manual work needed, but it will provide you with a good start to get the job done in no time…

Posted in Delphi Tagged with: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*