TECH TIP: Troubleshooting TdaMetache Errors
Running a report and/or acessing the Query tools, results in the following error…
Error: TdaMetacache.GetFields unable to find table ‘tablename’ in cache”
This error indicates an issue with the database connectivity settings for either the Query tools or the report’s DataViews.
The Designer’s DataSettings are used to specify the database connection that is used by the Query tools to create new queries and edit existing queries. Once a query dataview has been created, the database connection information is saved as part of the dataview definition.
At Delphi design-time the Designer’s DataSettings are loaded/saved from RBuilder.ini. They can be modified by accessing the File | DataSettings dialog from the Data workspace of the Report Designer.
At run-time the TppDesigner.DataSettings values are used to specify the data connection. The TppDesigner.AllowDataSettingsChange can be used to control whether the DataSettings dialog is accessible from the report designer.
Digital Metaphors recommends that in all cases the database connection be specified in the following manner.
- Use a Database Connection component that resides on a form/datamodule. For example, if you are using ADO, place a TADOConnection component on the form/datamodule that contains the report.
- Configure the Designer DataSettings DatabaseName property to reference the Database connection component.
- Use the Database Connection component to specify the connection parameters for the database.
This results in the following:
Designer DataSettings --> Database Connection component
Report DataViews ---> Database Connection component
With the above configuration, the Dataview definitions will never directly reference a database connection. This enables the Database connection component to be modified for deployment without breaking any reports.
The new connection settings will automatically be used by all existing reports and the query tools.
Note: The ReportBuilder Data workspace is designed to be used with only a single database connection at any one time. To speed performance, there is a global meta data cache that ReportBuilder uses to cache information about the available database tables and fields. You can clear the meta data cache using the following code.