Updated on 2024-06-03 GMT+08:00

PQconnectdb

Description

Establishes a new connection with the database server.

Prototype

PGconn* PQconnectdb(const char* conninfo);

Parameter

Table 1 PQconnectdb parameter

Keyword

Description

conninfo

Connection string. For details about the fields in the string, see 5.4.5 Connection Parameters.

Return Value

PGconn * points to the object pointer that contains a connection. The memory is allocated by the function internally.

Precautions

  • This function establishes a new database connection using the parameters taken from the string conninfo.
  • The input parameter can be empty, indicating that all default parameters can be used. It can contain one or more values separated by spaces or contain a URL.

Examples

For details, see Examples.