SQL error: could not connect to database
| От | Juba, Salahaldin I. |
|---|---|
| Тема | SQL error: could not connect to database |
| Дата | |
| Msg-id | D0835FE8F0FF4F4D933AB17A6CF25E390176785F9067@SXCHCL01.jacobs.jacobs-university.de обсуждение исходный текст |
| Ответы |
Re: SQL error: could not connect to database
|
| Список | 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 по дате отправления: