• cnxn = PQconnectdb(cnxn_info): Connect to the database using the supplied connection information.

  • Database is local, since another host wasn't specified in cnxn_info.

  • if (PQstatus(cnxn) != CONNECTION_OK): Check that the connection was successful, and if it wasn't, report the error and exit.