Search Postgresql Archives

Re: Cannot login, with C/C++ program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----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@xxxxxxxxx> 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-----


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux