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

From: Pedro Doria Meunier <pdoria(at)netmadeira(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Cannot login, with C/C++ program
Date: 2009-12-02 22:30:21
Message-ID: 4B16EA7D.6060303@netmadeira.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Brian Witt 2009-12-02 22:37:52 Re: use log_statement to log only SELECTs?
Previous Message Tom Lane 2009-12-02 21:42:01 Re: Cannot login, with C/C++ program