The same thing is happening when I compile the sample program:
postgresql-6.4.2/src/test/examples/testlibpq.c
when I put my own database name and set some of the PG env. variables.
bash$ testlibpq
Connection to database 'mydb' failed.
Unsupported frontend protocol.bash$
Bob VonMoss wrote:
> Yes, I can connect via JDBC and via 'psql -h mypghost.com mydb'
>
> Statistical Solutions wrote:
>
> > Are you running postgres with the -i option???
> >
> > On Sat, 3 Apr 1999, Bob VonMoss wrote:
> >
> > > Bob VonMoss wrote:
> > >
> > > > I'm trying to connect to a database from a C++ program compiled with
> > > > g++, linked to the libpq library on a Sun Solaris system. It is compiled
> > > > and run like this (my actual information has been changed to pseudonyms,
> > > > like mypghost.com, etc.)
> > > >
> > > > bash$ gmake
> > > > g++ -c -I /usr/local/pgsql/include test1.cpp
> > > > g++ -o test1 test1.o -L. -lpq -lsocket -lnsl
> > >
> > > I suppose my problem is here. I'm connecting via TCPIP not sockets. What
> > > libraries? I can't find this documented in the PG docs.
> > >
> > > > bash$ test1
> > > > Connection to database 'mydb' failed.
> > > > Unsupported frontend protocol.bash$
> > > >
> > > > It's failing at the command in the code below. No matter I try, I'm
> > > > getting the "Unsupported frontend protocol" message.
> > > >
> > > > int main()
> > > > {
> > > > ...
> > > > PGconn *conn;
> > > > char* dbname = "mydb";
> > > > /* make a connection to the database */
> > > > conn = PQsetdbLogin("mypghost.com", NULL, NULL, NULL, dbname,
> > > > "mylogin", "mypasswd");
> > > >
> > > > if (PQstatus(conn) == CONNECTION_BAD)
> > > > {
> > > > fprintf(stderr, "Connection to database '%s' failed.\n",
> > > >
> > > > dbName);
> > > > fprintf(stderr, "%s", PQerrorMessage(conn));
> > > > exit_nicely(conn);
> > > > }
> > > > ...
> > > > }
--
Bob VonMoss
mailto:[EMAIL PROTECTED]
from Chicago, IL