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

Easily Implement Robust Binary Large Object (BLOB) Streaming With FireDAC In Delphi

The Blobs sample shows you how to create a BLOB stream for reading and/or writing the value of a specific BLOB field on a specific record. To this end, the sample uses the CreateBlobStream method of TFDQuery to create a read-only BLOB stream. In this sample, the BLOB stream is used to read the picture contained on each BLOB field of each record of the Categories table.


You can find the Blobs sample project at:

  • Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to:
    • Object PascalDatabaseFireDACSamplesComp LayerTFDQueryBlobs
  • 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

  1. Navigate to the location given above and open Blobs.dproj.
  2. Press F9 or choose Run > Run.


File in DelphiContains
The project itself.
The main form.


Before running the sample, the main components are configured at design time using the Object Inspector as follows:

  • TFDQuery object named qCategories. This component is used to implement a dataset capable of executing SQL queries. The following setup is needed:
  • Configure the Connection property to specify the FireDAC connection object that is used to connect to a DBMS.
  • Set the SQL property to select * from {id Categories}. It specifies the SQL statement to execute for the query.
  • TDataSource object named dsCategories. This component provides an interface between a dataset component and data-aware controls on a form. In this sample, it is used to provide communication between the dataset and the grid where the dataset is displayed. To this end, the following setup is needed:
  • The DataSet property of dsCategories is set to qCategories.
  • The DataSource property of DBGrid1 is set to dsCategories.
  • TDBMemo object named DBMemo1. This component is used to display the Description field of the dataset. The following setup is needed:
  • Set the DataSource property of DBMemo1 to dsCategories.
  • Set the DataField property of DBMemo1 to Description.

When you run the application, the sample uses the CreateBlobStream method of TFDQuery with its mode set to bmRead in order to create a read-only BLOB stream. The BLOB stream is used to read the picture contained on the BLOB field of each record. Click on the Use Connection Definition combo box and select an option in order to define a connection. When you select an item of the combo box, the sample uses the Open method of qCategories in order to execute the SQL statement that retrieves the Categories table from the database. Then, the sample displays the Categories table using a TDBGrid component.

The original post of Embarcadero for this sample can be found in the link below:


Head over and check out the full source code for working with blobs in FireDAC in Delphi.

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.