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;
}