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

From Pedro Doria Meunier
Subject Re: Cannot login, with C/C++ program
Date
Msg-id 4B16EA7D.6060303@netmadeira.com
Whole thread Raw
In response to Re: Cannot login, with C/C++ program  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Did you check you pg_hba.conf ?
another thing: although port defaults to 5432 you *should* specify
that in the connection string.
also... is "sysdba" *really* an authorized user? check your permissions...

BR,
Pedro.

On 12/02/2009 09:42 PM, Tom Lane wrote:
> 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
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAksW6nMACgkQ2FH5GXCfxAuOBgCeMdssoz+fE26lFX9StTCksUyp
tAkAoKKbnjPrE4fk8HpEbLYJHq3wq7UB
=e3vc
-----END PGP SIGNATURE-----


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Cannot login, with C/C++ program
Next
From: Brian Witt
Date:
Subject: Re: use log_statement to log only SELECTs?