SQL error: could not connect to database - Mailing list pgsql-general

From Juba, Salahaldin I.
Subject SQL error: could not connect to database
Date
Msg-id D0835FE8F0FF4F4D933AB17A6CF25E390176785F9067@SXCHCL01.jacobs.jacobs-university.de
Whole thread Raw
Responses Re: SQL error: could not connect to database  (Kenichiro Tanaka <ketanaka@ashisuto.co.jp>)
List pgsql-general
I am trying to connect to  database using ECPG  called 'database' - please  see the code below-.  When I am excuting
thecode I am getting this message  

Fatal error
SQL error: could not connect to database "database" on line 22
Fatal error
SQL error: connection "NULL" does not exist on line 23


How can I make the ECPG access my database. I have already configured my database to trust all local connections and I
canlog in to postgresql without password prompt using the psql tool. where did I make a mistake and what are the
configurationI need to do 

I am using libecpg 6 and postgresql 8.4.4

Best,


#include <iostream>

using namespace  std;

EXEC SQL whenever sqlwarning sqlprint;
EXEC SQL whenever sqlerror do GiveUp();

void GiveUp()
{
fprintf(stderr, "Fatal error\n");
sqlprint();
}
int main()
{

    EXEC SQL BEGIN DECLARE SECTION;
        char id [] = "database";
    EXEC SQL END DECLARE SECTION;
    EXEC SQL CONNECT TO :id;
    EXEC SQL CREATE USER tom WITH PASSWORD 'myPassword';
    EXEC SQL DISCONNECT ALL;

return 0;
}

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: High Availability with Postgres
Next
From: "Joshua D. Drake"
Date:
Subject: Re: No PL/PHP ? Any reason?