Testing libpqxx, the C++ wrapper for libpq, the PostgreSQL C API.

I've compiled the libpqxx test applications for win32. I realise this is a fairly esoteric question, but maybe one of you will have the answer: what arguments should I pass to test001.exe to supply a database password? I'm getting this output:

Exception: fe_sendauth: no password supplied

Who is Participating?
clockwatcherConnect With a Mentor Commented:
Assuming that test001 is http://pqxx.org/development/libpqxx/file/tags/2.6.9/test/test001.cxx, then it doesn't take any arguments.  Your connection is constructed without a connect string:

   connection C;

The constructor ends up calling PQconnectdb:


which without any parameters bases the connection on your environment variables:  


If you don't want to base the connection on your environment, then you can include your connection string in the constructor (the format is per the PQConnectdb call):

   connection C("hostaddr= port=5432 dbname=test user=me password=tired");
You should start out with http://www.postgresql.org/docs/7.3/static/client-authentication.html ("Client Authentication") to configure the DB first.
sternoceraAuthor Commented:
I can connect to the db using the supplied gui tool. This test program just establishes whether you have the statically linked library working (I compiled the program, which uses the static library which I also compiled). It's just a test.
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

So what is the code for the test tool?
sternoceraAuthor Commented:
Thats very useful clockwatcher, thanks. One other thing. I cannot get libpq to compile a debug version, just a release, so I've copied the release folder, renamed it debug and appended a "d" to each of the dlls/libs. This is a sleazy hack that I'd rather do without.

The libpqxx documentation advises that if you cannot build a debug, change the common file so that it points to release as release and release as debug. However, it looks for the actual debug folder anyway at some point (as appose to looking for the folder I *told* it was the debug folder, release), so this peice of advice wasn't very well thought through. How can I build the debug to satisfy this requirement properly? I've built the release in the standard way, "nmake /f win32.mak" as outlined in http://developer.postgresql.org/pgdocs/postgres/x19700.html .

Thanks Again,
sternoceraAuthor Commented:

I've decided to make this a seperate question, for the sake of clarity for others who may read these posts a later time: http://www.experts-exchange.com/Database/PostgreSQL/Q_22751602.html

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.