All Products
Search
Document Center

AnalyticDB:libpq

Last Updated:Feb 19, 2024

libpq is the C language interface to PostgreSQL. libpq provides a set of functions and methods for you to interact with AnalyticDB for PostgreSQL in C programs and perform database operations such as connection, query, insertion, update, and deletion.

Prerequisites

  • The internal or public endpoint of an AnalyticDB for PostgreSQL instance is obtained.

    • If your client is deployed on an Elastic Compute Service (ECS) instance that resides in the same region and uses the same network type as the AnalyticDB for PostgreSQL instance, you can use the internal endpoint to connect to the AnalyticDB for PostgreSQL instance. Log on to the AnalyticDB for PostgreSQL console. In the Database Connection Information section of the Basic Information page, view the internal endpoint of the instance.

    • If your client is deployed on an ECS instance that resides in a different region or uses a different network type from your AnalyticDB for PostgreSQL instance or a system outside Alibaba Cloud, you must apply for a public endpoint and then use the public endpoint to connect to the AnalyticDB for PostgreSQL instance. For more information about how to apply for a public endpoint, see Manage public endpoints.

  • The IP address of your client is added to an IP address whitelist of the AnalyticDB for PostgreSQL instance. For more information, see Configure an IP address whitelist.

Procedure

After you install Greenplum or PostgreSQL, you can find the static and dynamic libraries of libpq in the lib directory.

Important

For AnalyticDB for PostgreSQL V7.0, install PostgreSQL 12 to obtain the correct version of libpq.

  • For information about libpq connection cases, see the following topics:

  • For more information about libpq, see the following topics:

References

The Greenplum official website provides a libpq package that is easy to use. For more information, see the Greenplum documentation.