2. Sample ODBC Connection

It is important to keep in mind that ODBC drivers have differing levels of capability. For example, SQL written against one database using a specific driver may not function the same way when accessing the same database using an ODBC driver. OpenRPT was developed with a native connection to PostgreSQL. It can also connect to other databases using ODBC, but you should temper your expectations by the limitations of the ODBC driver you implement.

Below we see the ODBC settings used to establish the connection to the Access database we will use throughout this chapter:

ODBC Connection Settings

The name of this connection is “contacts,” and as you will see, this is the reference we will use when connecting OpenRPT tools to the database. The connection also identifies the location and name of the Access database file (CONTACTS.MDB), which is the file that physically contains the database.

Note

Some ODBC connections require database usernames and passwords for authentication. Authentication is implemented by the ODBC driver; not by OpenRPT.

The first step when creating any OpenRPT report is to create the report’s SQL. We will use the MetaSQL editor to accomplish this.