3.10. Database connections

Most of reports use data from databases. To connect to a database, you should:

- specify the database connection component (for example, TADOConnection) in one of your application forms;

- use internal data access components (such as TfrxADOTable, TfrxADOQuery) in your report. To connect to the database, these components should use the application connection.

In this case, a report will be thread-safe, using single connection to the database. In case some data access components do not support simultaneous work with database through a single connection, you should use the way described below.

The other way is to use the database connection component (such as TfrxADODatabase) in each report. In this case, you will be able to connect to different databases at one time. We do not recommend this way if you do not need this functionality because each time when report starts, it will attempt to connect to the database (in some DB servers the connection may take a long time).

Read the "FastReport 3 - User manual" [9] to learn more about creating reports with internal data access components (page 134).

It is not recommended to use BDE to connect to a database. BDE has a great amount of problems when working with several threads.

| < previous page |  | main page | next page > |