Skip site navigation (1) Skip section navigation (2)

psqlodbc libpq version: quiet error on connect failure

From: Marko Ristola <Marko(dot)Ristola(at)kolumbus(dot)fi>
To: pgsql-odbc(at)postgresql(dot)org
Subject: psqlodbc libpq version: quiet error on connect failure
Date: 2005-07-20 11:23:19
Message-ID: 42DE3427.5040607@kolumbus.fi (view raw or flat)
Thread:
Lists: pgsql-odbc
Problem

psqlodbc, with libpq enabled, will do exit(1), if connecting into the
database fails.
A good fix seems to be to remove the exit_nicely() function call.

----------------------
static void
exit_nicely(PGconn *conn)
{
        PQfinish(conn);
        exit(1);
}
----------------------

Connect code:

    self->pgconn = PQconnectdb(conninfo);
    if (PQstatus(self->pgconn) != CONNECTION_OK)
    {
       
CC_set_error(self,CONNECTION_COULD_NOT_ESTABLISH,PQerrorMessage(self->pgconn));
        mylog("could not establish connection to the database %s
\n",PQerrorMessage(self->pgconn));
        exit_nicely(self->pgconn);
        free(conninfo);
        return 0;
    }

------------------------

Marko Ristola


pgsql-odbc by date

Next:From: Marko RistolaDate: 2005-07-20 11:27:02
Subject: A correction into the connect exit(1) problem
Previous:From: Bob CarylDate: 2005-07-19 14:25:01
Subject: PostgreSQL OBDC Problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group