Thread: libpq problem

libpq problem

From
Brian Eldridge
Date:
Greetings!  I'm new to this list, so if I over step some bounds or am
writing
to the incorrect list, please bear with me.

I'm trying to write an interface to a Linux implementation of PostgreSQL
6.4.2
from a Win 95 box.  I downloaded the libpq.lib and it's cohorts for
6.4.2 for a
Windows 95 box.  I'm having no trouble linking or compiling.  My problem
is
one of a run-time nature.  Whenever I try to connect to my Linux box, I
get
an "unknown host" error from libpq.  If I use the psql.exe that came
with the libs,
it works fine.  This is both, if I use an environment variable or use
the -h flag.
I can even connect using ODBC and MS Query, but whenever I try to
connect
with my homegrown prog, I get the invalid host error.  Below is the code
I'm using
to connect:

    pgdatabase = PQsetdb(szHost, szPort, NULL, NULL, szDatabase);

szHost, szPort, and szDatabase are all passed in.  I've verified their
values, and
they are correct (i.e. the same values being passed to psql.exe).  I've
gone as
far as to look at the psql.c file that came with my PostgreSQL source
and it does
a very similar call to PQsetdb:

    settings.db = PQsetdb(host, port, NULL, NULL, dbname);

Any one have any idea why this might be happening?

Thanks in advance,
Brian