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:

C:\libpqxx-2.6.9\TestStaticRelease>test001.exe
Exception: fe_sendauth: no password supplied

Thanks
sternoceraAsked:
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:

   http://www.postgresql.org/docs/8.1/static/libpq.html#LIBPQ-CONNECT

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

   http://www.postgresql.org/docs/8.1/static/libpq-envars.html


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=127.0.0.1 port=5432 dbname=test user=me password=tired");
0
 
jkrCommented:
You should start out with http://www.postgresql.org/docs/7.3/static/client-authentication.html ("Client Authentication") to configure the DB first.
0
 
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.
0
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.

 
jkrCommented:
So what is the code for the test tool?
0
 
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,
Sternocera
0
 
sternoceraAuthor Commented:
Clockwatcher,

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

Thanks
0
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.