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

Quick Introduction To FireDAC And Its Features For Building Robust Delphi/C++ Builder Database Applications.

FireDAC is a powerful, yet easy-to-use access layer that supports, abstracts, and simplifies data access, providing all the features needed to build real-world high-load applications. FireDAC provides a common API for accessing different database back-ends, without giving up access to unique database-specific features and without compromising on performance. Use FireDAC in Android, iOS, Windows, and Mac OS X applications you are developing for PCs, tablets and smartphones.

FireDAC Design Objectives and Architecture :

  • FireDAC enables native high-speed direct access from Delphi and C++Builder. 
  • Provides Universal Data Access i.e) Application built for a single data base can be used for other databases with very minimal changes at configuration.
  • Highly configurable, using this you can fine tune your data access and it is important how your Software access with databases.
  • Simple to deploy as no specific driver required, along with executable it is built.
  • FireDAC local/embedded connectivity to certain local databases, including Microsoft Access database, SQLite database, InterBase ToGo / IBLite, InterBase on localhost, MySQL Embedded, MySQL Server on localhost, Advantage Database local engine, PostgreSQL on localhost, Firebird Embedded, and Firebird on localhost.
  • Full source code provided, Developers can understand the underlying design and source code.
  • Compatibility with the BDE means easy migration of legacy applications with reFind Utility.
<strong>FireDAC Architecture<strong>

Supported Database : InterBase, SQLite, MySQL, SQL Server, Oracle, PostgreSQL, IBM DB2, SQL Anywhere, Access, Firebird, Informix and more.

Working With Database connections :

Option 1: You can connect with any of the above listed Databases either from a Local Machine or Remote DBMS machine using the Data Explorer in the IDE. It is a tabbed pane that is located, along with the Projects Window and the Model View tabs, in the upper-right corner of the IDE window. Can use this, to create new connections, modifies, deletes, or renames your database connections. 

  • The Data Explorer works for databases that use dbExpress or FireDAC connection types.
  • The Data Explorer lets you browse database server-specific schema objects, including tables, fields, stored procedure definitions, stored functions, triggers, and indexes. FireDAC databases also display primary keys, foreign keys and generators.
  • The Data Explorer presents a list of available database types (such as DATASNAP and MYSQL) that you can access and perform various actions on, using the context menus. With Data Explorer, you can easily create and manage database connections. Additionally, you can drag and drop data from a data source to a project to build your database application quickly.
  • The commands available in the Data Explorer depend upon the object selected in the tree view. To display the associated context menu commands, right-click the following node types:
  • You can also use Data Explorer to Obtain connection information, Check here.

Option 2 : Create/Modify the connection via TFDconnection component by double clicking which will shows the editor same as Data explorer, where you can provide the DriverId, Username, Database name, Password etc. The connection string is stored in the TFDConnectionDefsparams and it is binded with application as hard-coded values. What if the database path changes after deployment of the application, you need to rebuild to avoid error in connection. To avoid such hard coded connection information, we can select the Connection Definition name in the TFDConnection editor, where Connection definition name need to be predefined and stored in the FDConnectiondefs.Ini file. The connection definitions for different databases are stored in the following fpath. C:\Users\Public\Documents\Embarcadero\Studio\FireDAC\FDConnectionDefs.ini

To create TFDconnection with connection information, a clever way is to drag and drop a table highlighted in the connected database(from data explorer) to the form.

For the Quick introduction and connection with FireDAC component watch the below video.

Note: This video is from 2015 but the information about FireDAC is still relevant today. Additionally, Pawel Glowacki has passed away since then. He is the author of Expert Delphi if you want to check out his book.

See What's New in 12.2 Athens See What's New in 12.2 Athens Dev Days of Summer 2-24

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

Leave a Reply

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

IN THE ARTICLES