Connect to PostgreSQL Database
In This Topic
This article demonstrates how to connect to a PostgreSQL database with the ODBC driver. The following steps assume that you have the required configuration details to connect to a PostgreSQL database.
You will need to install the PostgreSQL ODBC driver that will allow you to connect with PostgreSQL data.
Install the PostgreSQL ODBC driver
- Download the latest 32-bit version of Postgres ODBC driver.
Note: Since the ActiveReports Designer application is a 32-bit application, you should use the 32-bit PostgreSQL ODBC driver. In case you are using the ActiveReports Visual Studio Integrated Designer in your .NET application, depending on the target platform x86 or x64, you need to accordingly download a 32-bit or a 64-bit PostgreSQL ODBC driver.
- Extract the files and run the .msi file.
Set up the ODBC data source for PostgreSQL
- Open the ODBC Data Source application. An ODBC Data Source Administrator dialog box appears.
- Navigate to the System DSN tab and click Add.
- In the Create New Data Source dialog box that displays, select the PostgreSQL Unicode driver from the list, and click Finish.
- Fill in the configuration details required for the PostgreSQL including the server, port, username, password, and database. The configured DSN is PostgreSQL35W as shown.
- Click Test to verify the data source connection. The following dialog box will appear on a successful connection.
- Click OK to save the changes.
Connect to PostgreSQL with the ODBC connection string
- Open the ActiveReports Designer application. By default, an RDLX report is created.
As you create a new report, Report Data Source dialog appears for you to configure the report data connection. You can also access this dialog by right-clicking the Data Sources node in the Report Explorer and then selecting the Add Data Source option.
- In the Report Data Source dialog, select the General page and enter the name of the data source in the Name field.
- Under the Type field, select Microsoft Odbc Provider.
- On the same page, under the Connection section, enter the connection string to connect to the data source.
The format of the connection string is as follows -
Connection String |
Copy Code
|
DSN=PostgreSQL35W;Server=<server>;Port=<port>;User Id=<user id>;Password=<password>;Database=<database>
|