PQconnectdb returning NULL, why?
===

Context
-------

I've just installed postgres 9.1.4 on Lion, and i would like to write a simple client in C (libpq) to connect to PG databases.

_psql -l_ says that there is a database named _mydb_ owned by _postgresDB_.

_psql mydb_ says : _mydb=#_


Here the little program that tries to connect to mydb :

    // Server coordinates
    const char * keywords[] = {"dbname", "user", NULL};
    const char * values[] = {"mydb", "postgresDB", NULL};

    // Check server state
    analyse_PQpingParams (PQpingParams (keywords, values, 0));

    // Connect to the database
    PGconn * conn; 
    conn = PQconnectdbParams (keywords, values, 0);

    // Check if the connection is healthy
    analyse_PQstatus (PQstatus (conn));
  
    // Clean exit
    PQfinish (conn);
    exit (0);

Problem
-------

Here what the program retuns :

    analyse_PQpingParams says :
    ------
    The server is running and appears to be accepting connections.
    ------

    analyse_PQstatus says :
    ------
    The state returned was NULL.
    ------

Why is the _conn_ object _NULL_ ? 

What the documentation says :
-----------------------------
_Note that these functions will always return a non-null object pointer, unless perhaps there is too little memory even to allocate the PGconn object._ If it was a memory problem, then _psql_ could not have connected to my db. So, the documentation doesn't help here. Maybe elsewhere ?

Many thanks for your answers !

Pierre.