Re: Cannot login, with C/C++ program - Mailing list pgsql-general

From Tom Lane
Subject Re: Cannot login, with C/C++ program
Date
Msg-id 22806.1259790121@sss.pgh.pa.us
Whole thread Raw
In response to Cannot login, with C/C++ program  (Daniel <danwgrace@gmail.com>)
Responses Re: Cannot login, with C/C++ program  (Pedro Doria Meunier <pdoria@netmadeira.com>)
List pgsql-general
Daniel <danwgrace@gmail.com> writes:
> I have written a C/C++ program that trys to log into a local
> PostgreSQL database.  Here is the code:

>   pg_conn = PQconnectdb(
>     "hostaddr = '127.0.0.1' port = '' dbname = 'TBDB' user = 'sysdba'
> password = 'stelmo777' connect_timeout = '10'");
>   if (!pg_conn)
>   {
>     return false;
>   }
>   if (PQstatus(pg_conn) != CONNECTION_OK)
>   {
>     return false;  // <- execution reaches here.

> I checked the database, user and password by logging in with psql.
> What could be wrong?

If you print out the connection object's error message, you might
find out.  It's hard to guess about it without that information.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Catastrophic changes to PostgreSQL 8.4
Next
From: Pedro Doria Meunier
Date:
Subject: Re: Cannot login, with C/C++ program