Connect to Postgre SQL (AnyDAC)
From RemObjects Software
This is a AnyDAC Database Connectivity entry
Feel free to add your notes to this topic below.
General
Currently, AnyDAC v 2.0 does not have a native Postgre SQL driver, but you can use the AnyDAC/ODBC Bridge driver to connect to Postgre SQL.
We plan to implement a native PG SQL driver in version 3 (see ROadmap).
For now, you can download one of the Postgre SQL ODBC drivers:
- ODBCng (details). It is a wire-level ODBC driver, meaning that it does not require libpq or any PostgreSQL libraries be installed to function. ODBCng is licensed under the GPL.
- psqlODBC (details or direct link to download area). It is bundled with all required Postgre SQL client dynamic libraries. psqlODBC is licensend under the LGPL.
Note that we had problems with earlier versions (prior to 2007). So, you need to ensure that you have a recent version of the ODBC driver.
Connect using the AnyDAC/ODBC Bridge
- Download and install one of the ODBC drivers. We will use psqlODBC as an example.
- Create the connection definition, adding it manually to ADConnectionDefs.ini. For example:
[My_PGSQL] DriverID=ODBC User_Name=postgres Password=marlboro ODBCDriver=PostgreSQL ANSI ODBCAdvanced=SERVER=localhost;PORT=5432;DATABASE=addemo
Alternatively, run ADExplorer:
- add a new connection definition
- set Driver ID to ODBC and ODBCDriver to "PostgreSQL ANSI", then press Ctrl+A to save connection definition.
- select Connection -> Run Wizard and specify the Postgre SQL connection parameters.
Next:
- Drop a TADDatabase component on the form
- Set the ADDatabase1.ConnectionDefName to My_PGSQL
See Also
- AnyDAC Database Connectivity
- AnyDAC FAQs
- How to configure AnyDAC Drivers
- How to manage AnyDAC Connection Definitions
Glossary — Features — How To — Components — Tools — Samples — Articles — Architecture — Issues
Categories: Text | AnyDAC | Connection
