vcl-405737-expresscrossplatformlibrary-vcl-backend-database-engines-vcl-backend-firebird-support.md
Firebird is an open-source SQL relational database management system. You can connect TdxDashboard/TdxDashboardControl and TdxReport components to Firebird databases using the TdxBackendDatabaseSQLConnection component.
In this topic…
Tip
This guide uses the following sample Firebird database that ships with Firebird Server Components ( Prerequisites ):
C:\Program Files\Firebird\Firebird_5_0\examples\empbuild\EMPLOYEE.FDB
Prerequisites — Download & Install Firebird Server Components
Tip
The Firebird component installer adds a set of examples to the following folder:
_C:\Program Files\Firebird\Firebird_5_0\examples_
Create a new project and place TdxDashboardControl and TdxBackendDataConnectionManager components on a form.
Double-click the TdxBackendDataConnectionManager component on the form to open the Collection Editor dialog, click the Add button, and select the Database (SQL) option to create a TdxBackendDatabaseSQLConnection component:
The previously added TdxBackendDatabaseSQLConnection component connects to the source Firebird database using a connection string. To configure this component and specify a valid connection string, add a TcxButton component to a form and handle the component’s OnClick event as demonstrated in the following code example:
uses
dxDashboard.Control, // Declares the TdxDashboardControl component
dxBackend.ConnectionString.SQL; // Declares the TdxBackendDatabaseSQLConnection component
// ...
procedure TMyForm.cxDisplayDesignerButtonClick(Sender: TObject);
begin
dxBackendDatabaseSQLConnection1.Active := False; // Terminates the current connection (if one exists)
// Specify a user-friendly data connection name (for end-user dialogs) and a valid connection string:
dxBackendDatabaseSQLConnection1.DisplayName := 'Firebird Database Connection';
dxBackendDatabaseSQLConnection1.ConnectionString :=
'XpoProvider=Firebird;' + // Specifies the database engine type
'Datasource=localhost;' + // Specifies the database location (IP 127.0.0.1)
'User=SYSDBA;' + // Specifies a valid user name
'Password=password;' + // Specifies the corresponding password for the user names
'Database=C:\Program Files\Firebird\Firebird_5_0\examples\empbuild\EMPLOYEE.FDB;' +
'ServerType=0;Charset=NONE'; // Specifies additional parameters
dxBackendDatabaseSQLConnection1.Active := True; // Connects to the EMPLOYEE.FDB database
dxDashboardControl1.ShowDesigner; // Displays the "Dashboard Designer" dialog
end;
#include "dxDashboard.Control.hpp" // Declares the TdxDashboardControl component
#include "dxBackend.ConnectionString.SQL.hpp" // Declares the TdxBackendDatabaseSQLConnection component
// Add the following linker directives to the corresponding CPP source file:
#pragma link "dxDashboard.Control" // Required to use dxDashboard.Control.hpp declarations
#if defined(_WIN64) // Required to use dxBackend.ConnectionString.SQL.hpp declarations
#pragma link "dxBackend.ConnectionString.SQL.o"
#else
#pragma link "dxBackend.ConnectionString.SQL.obj"
#endif
// ...
void __fastcall TMyForm::cxDisplayDesignerButtonClick(TObject *Sender)
{
dxBackendDatabaseSQLConnection1->Active = false; // Terminates the current connection (if one exists)
// Specify a user-friendly data connection name (for end-user dialogs) and a valid connection string:
dxBackendDatabaseSQLConnection1->DisplayName = "Firebird Database Connection";
dxBackendDatabaseSQLConnection1->ConnectionString =
L"XpoProvider=Firebird;" // Specifies the database engine type
L"Datasource=localhost;" // Specifies the database location (IP 127.0.0.1)
L"User=SYSDBA;" // Specifies a valid user name
L"Password=password;" // Specifies the corresponding password for the user name
L"Database=C:\\Program Files\\Firebird\\Firebird_5_0\\examples\\empbuild\\EMPLOYEE.FDB;"
L"ServerType=0;Charset=NONE"; // Specifies additional parameters
dxBackendDatabaseSQLConnection1->Active = true; // Connects to the EMPLOYEE.FDB database
dxDashboardControl1->ShowDesigner(); // Displays the "Dashboard Designer" dialog
}
Tip
Alternatively, you can select the created TdxBackendDatabaseSQLConnection component in the Collection Editor and specify all required settings using the Object Inspector.
The application form contains TdxDashboardControl and TcxButton components:
Run the built executable file and click the previously added button to display the DevExpress Dashboard Designer dialog. Click the hamburger button, select the Data Sources item, and click the Add link in the DATA SOURCES pane:
Click the Create data source… link in the Add Data Source modal dialog:
Select Database in the Dashboard Data Source Wizard modal dialog and click Next :
The wizard displays the created data connection component using its display name specified earlier.
Click Next and use the Run Query Builder… option:
Expand the AVAILABLE TABLES AND VIEWS node to browse tables from the connected database:
If the AVAILABLE TABLES AND VIEWS node contains a list of tables from the sample EMPLOYEE.FDB database, the created Firebird connection is successful.
The Firebird Server service may conflict with Embarcadero InterBase services usually installed with a RAD Studio IDE. If the Query Builder dialog does not display any content from a Firebird database, do the following:
Run the InterBase Server Manager tool (installed with InterBase Server components).
Enable Manual startup mode and stop the InterBase server:
Open the Microsoft Windows Services manager and ensure that InterBase Server and InterBase Guardian services are stopped.
Restart your test app and repeat all steps described in the following help topic section: Run App & Test Database Connection.
Important
Depending on Firebird and InterBase server versions, you may also need to reinstall Firebird server components from scratch once InterBase server services are stopped.
Review the following tutorials to get started with TdxDashboardControl and TdxReport components:
Create a Dashboard Using the Designer DialogCreate a dashboard application: configure Bubble Map and Chart dashboard items, and bind them to data at design time.Create a Table Report Using the Report WizardCreate a simple report application: define a table report layout and bind it to data using the Report Wizard dialog at design time.
Refer to the following topics for step-by-step instructions on using corresponding database systems for ExpressReports and ExpressDashboards:
VCL Dataset and Data Source ComponentsThe TdxBackendDataSetJSONConnection component allows you to bind TdxDashboard/TdxDashboardControl and TdxReport to one or multiple datasets (TdxMemData, TFDTable, TFDQuery, and other TDataSet descendants) using TDataSource components.In-Memory/Remote Web ServiceThe TdxBackendInMemoryJSONConnection component allows you to bind TdxDashboard/TdxDashboardControl and TdxReport components to JSON data defined in code or loaded from a remote Web API service endpoint.SQLiteSQLite is a file-based relational database engine.Microsoft SQL/Azure DatabasesMicrosoft SQL Server and Azure SQL Database are proprietary relational database management systems developed by Microsoft.
PostgreSQLPostgreSQL is an open-source database management system.Oracle DatabaseOracle Database is a proprietary multi-model database management system developed by the Oracle Corporation.MySQLMySQL is an open-source relational database management system developed by the Oracle Corporation.
Footnotes
See Also