This article guides you through different AnyDAC options of DBMS environment checking and reporting. Such report kind is a must for your customer support and the developer team.
All developers and supporters know the moment a customer calls about his application not running properly. Normally, it takes several phone calls or emails to get all the necessary details about his environment. Often the customer does not even have all this information.
In general, a DBMS application may fail due to:
AnyDAC provides the necessary methods to report all these details:
The ADExplorer utility is the main tool to maintain the centralized persistent connection definitions. Please, read the ADExplorer reference for further details.
To get a detailed report for your persistent connection definition, run ADExplorer. Then choose a connection definition in the tree on the left side. On the right side click on the Info page. There you will see detailed environment report.
The report includes the sections:
The next screen shot shows the report for a MySQL connection definition. In this case the DBMS client software was loaded and the connection was activated:
The TADConnection component design time editor is the environment to maintain temporary connection parameters. Double click any TADConnection component at design time. The AnyDAC package will display the Connection Editor dialog.
Click on the Info page to get a detailed report for your connection definition. You will get a detailed environment report as described above. The only difference: if a TADConnection component is not connected, than the dialog will try to establish a temporary connection to a DBMS to fetch the server data.
The next screen shot shows the resulting report:
The AnyDAC offers several possibilities to integrate the DBMS runtime information of your environment into your own project.
You can start the DBMS report directly by calling the TADConnection.GetInfoReport method:
procedure TMainForm.Button1Click(Sender: TObject); begin ADConnection1.GetInfoReport(mmInfo.Lines); end;
This method is declared as:
procedure GetInfoReport(AList: TStrings; AItems: TADInfoReportItems);
The AItems flags meaning is:
If you want to display the AnyDAC build number (e.g. in the About box) than just refer to the CONST C_AD_Version in the uADStanConst unit. Example:
C_AD_Version = '5.0.2 (Build 1896)';
To get a DBMS client and/or server version number (e.g. to switch on or off some feature in your application), use the TADConnection component and open the connection. Then use the following code sample, showing how to access the physical metadata:
procedure TMainForm.Button2Click(Sender: TObject); var oMetaIntf: IADPhysConnectionMetadata; begin // Get client and server versions oMetaIntf := ADConnection1.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 uADStanConst unit:
The DBMS version is represented in AnyDAC by the LongWord value, consisting of the 5 groups of digits, where each group has 2 digits. Although, the leftmost group may have one single digit. For example, mvMySQL032321 = 0323210000. It corresponds to 3.23.21.0.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;
<AnyDAC>\Samples\Comp Layer\TADConnection\InfoReport
|
What do you think about this topic? Send feedback!
|