ecpg
ecpg
От:
"Chris McNett" <chrismcnett@hotmail.com>
Дата:
(Remember to reply to both me and the list, as I do not subscribe to the
list.)
I am using ecpg and get error -402 (cannot connect to database). The
database works fine with the psql command. It probably won't help, but here
is my code:
#include
main()
{
EXEC SQL BEGIN DECLARE SECTION;
/* list of declarations */
EXEC SQL END DECLARE SECTION;
int i;
EXEC SQL INCLUDE sqlca;
EXEC SQL CONNECT databasename; /* error happens here */
if(sqlca.sqlcode)
printf("Error connecting to database server.
errcode
%d",sqlca.sqlcode);
/* more code to access database */
EXEC SQL COMMIT RELEASE;
return(0);
}
It compiled fine and linked successfully with libecpg and libpq.
Thanks!
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.
Re: ecpg
От:
"Jochen Weyermanns" <jowe@kisters.de>
Дата:
Hi Chris ! > I am using ecpg and get error -402 (cannot connect to database). The > database works fine with the psql command. It probably won't help, but here > is my code: > EXEC SQL BEGIN DECLARE SECTION; > /* list of declarations */ > EXEC SQL END DECLARE SECTION; > ... > EXEC SQL CONNECT databasename; /* error happens here */ I think You have to prefix an ':' to variables for usage within embedded SQL statements Try this: EXEC SQL connect to :databasename user :username; Jochen