DBMS Environment Reports (FireDAC)
Go Up to Debugging and Support (FireDAC)
This topic guides you through different FireDAC checking and reporting options in a Database Management System (DBMS). These FireDAC reports provide the methods to report all the necessary details about the user environment, which drastically reduces the amount of time the customer, the developer, and the customer support professional spend in order to identify and solve a problem.
Things you can do with FireDac:
- Using the FDExplorer or FDAdministrator---get the report of your persistent connection definition.
- Using the TFDConnection Design Time Editor--get the detailed report about a connection definition.
- By code--use Delphi code to integrate reporting capabilities into your application.
In general, a DBMS application may fail due to:
- Missing DBMS client libraries.
- Incorrect version of the DBMS client, server, or both.
- Incorrect connection definition setup.
- Compatibility issues like Unicode support.
The FireDAC checking and reporting options help you identify the source of the problem in a timely manner.
The FDExplorer utility is the main tool to maintain the centralized persistent connection definitions.
To get a detailed report for your persistent connection definition, run FDExplorer. Choose a connection definition in the tree on the left. To get the detailed environment report for the connection, click the Info page on the right side.
The report includes the sections:
- Connection definition parameters--complete set of connection definition parameters.
- FireDAC info--details about your FireDAC build.
- Client info--information about the DBMS client software, if it is properly installed so that FireDAC can load it successfully. Otherwise you get a failure error message.
- Session info--information about the DBMS server and the user session, if FireDAC can successfully open the connection. Otherwise you get a failure error message.
The following image shows the report for a SQLite connection definition. In this case, the DBMS client software was loaded and the connection was activated.
Using the TFDConnection Design Time Editor
The TFDConnection component's design-time editor is the environment to maintain temporary connection parameters. Double-click any TFDConnection component at design time. The FireDAC package will display the Connection Editor dialog.
To get a detailed report for your connection definition, as previously described, click the Info page.
Note: If a TFDConnection component is not connected, then the dialog tries to establish a temporary connection to a DBMS to fetch the server data.
The following image shows the resulting report.
Using Delphi Code
You can start the DBMS report directly by calling the TFDConnection.GetInfoReport method:
procedure TMainForm.Button1Click(Sender: TObject); begin FDConnection1.GetInfoReport(mmInfo.Lines); end;
This method is declared as:
procedure GetInfoReport(AList: TStrings; AItems: TFDInfoReportItems);
AItems flag's values are:
riConnDef--include connection definition parameters into a report.
riFireDAC--include FireDAC build info into a report.
riClientLog--include DBMS client loading log.
riClient--include DBMS client info into a report.
riSessionHints--include potential incompatibilities of FireDAC, DBMS client, and server.
riSession--include a DBMS session info into a report.
riTryConnect--try to connect to a DBMS, if not already connected.
riKeepConnected--when the method established a connection, keep it active.
AList--target string list to append the report.
See the <FireDAC>\Samples\Comp Layer\TFDConnection\InfoReport demo project.
Getting the FireDAC Build Number
If you want to display the FireDAC build number (for example, in the About box), then just refer to the
CONST C_FD_Version in the
FireDAC.Stan.Const unit. Example:
C_FD_Version = '8.0.5 (Build 3365)';
Getting the DBMS version
To get a DBMS client and/or server version number (for example, to switch on or off a feature in your application), use the TFDConnection component and open the connection. Then use the following code sample, which shows how to access the physical metadata:
procedure TMainForm.Button2Click(Sender: TObject); var oMetaIntf: IFDPhysConnectionMetadata; begin // Get client and server versions oMetaIntf := FDConnection1.ConnectionMetaDataIntf; try ShowMessage(Format('Client version: %.10d; Server version: %.10d', [oMetaIntf.ClientVersion, oMetaIntf.ServerVersion])); finally oMetaIntf:= nil; // always release the interface before you close the connection end; end;
You can find many predefined DBMS version numbers in the
- cvOracleXXX--for Oracle
- mvMySQLXXX--for MySQL
- svMSSQLXXX--for MSSQL
- svSQLiteXXX--for SQLite
- svPGSQLXXX--for PostgreSQL
- ivIBXXX--for InterBase
- ivFBXXX--for Firebird
The DBMS version is represented in FireDAC by a LongWord value consisting of 5 groups of digits, where each group has 2 digits (the leftmost group may have only one digit).
For example, mvMySQL032321 = 0323210000 corresponds to 22.214.171.124.0. This allows direct comparison of a client or server version with a constant:
if oMetaIntf.ServerVersion >= mvMySQL050000 then begin // execute MySQL 5.0 or higher specific SQL end else begin // execute pre-MySQL 5.0 SQL end;
- <FireDAC>\Samples\Comp Layer\TFDConnection\InfoReport