1. Home
  2. /
  3. Docs
  4. /
  5. Articles Report Writer
  6. /
  7. Database Components
  8. /
  9. FD Components
  10. /
  11. FD Database

FD Database

The FD Database component defines a connection to your database. Every report that fetches data from a database needs at least one FD Database component. All other FD components — FD Query, FD Table, FD MemTable, and FD Stored Proc — use the FD Database to know where and how to connect.

Adding an FD Database to Your Report

Open the report designer and drag an FD Database component onto the designer surface. It does not matter where you place it — data components are not visible when the report prints. By convention, place data components in the top-left area of the designer surface to keep them out of the way.

Once placed, click the component to select it and configure its properties in the Object Inspector on the right.

Connecting to a Database

The simplest and most reliable way to connect is to use a Connection Definition Name. A connection definition is a named, pre-configured connection that has been set up in Articles. Using a connection definition name means your report does not store the server address, username, or password directly — it just references the named connection by name.

To connect using a connection definition:

  1. Select your FD Database component in the designer
  2. In the Object Inspector, find the ConnectionDefName property
  3. Type or select the name of your connection definition
  4. Set Connected to True to test the connection

If the connection succeeds, the FD Database is ready to use. If it fails, check the LastError property — it will contain a description of what went wrong.

Properties

ConnectionDefName
The name of a pre-configured connection definition. This is the recommended way to connect. When you use a connection definition name, the database credentials are stored securely in Articles rather than in the report file.

Connected
Set to True to open the connection, False to close it. During report design you can toggle this to test your connection. When the report runs, Articles manages the connection state automatically.

LoginPrompt
When True, the user is prompted for a username and password when the connection opens. Default is False. Leave this False unless your connection requires interactive login.

DatabaseName
The name of the database to connect to. For most connection types this is set inside the connection definition and you do not need to set it here.

DriverName
The FireDAC driver to use for this connection, for example MSSQL, MySQL, or Zen. For most setups this is handled by the connection definition and you do not need to set it here.

Params
Additional connection parameters passed directly to the FireDAC driver. These are advanced settings. For most reports you will not need to set these — use ConnectionDefName instead.

LastError
Read-only. If the last connection attempt failed, this property contains the error message. Useful for diagnosing connection problems at design time.

Using Multiple Databases in One Report

A report can contain more than one FD Database component. This is useful when your report pulls data from two different databases — for example, combining data from your main database and an archive database.

To use multiple databases, add one FD Database component for each connection and give each a unique name, for example FDDatabase1 and FDDatabase2. Then set the Database property on each FD Query to point to the correct FD Database.

Common Problems

The connection fails at design time but works when the report runs
This usually means the connection definition is not available on your current machine. Connection definitions are set up per machine. Check that the connection definition name matches exactly what is configured in Articles on your machine.

LastError shows “Unknown connection error”
The database server could not be reached. Check that the server is running, the server name is correct, and that your network can reach it.

The report prompts for a login when it should not
Check that LoginPrompt is set to False and that the connection definition includes valid credentials.

Related Pages