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


Reply via email to