Christoph Zwerschke schrieb:
> Johannes Bauer schrieb:
>> self.db_conn = pgdb.connect("%s:%s:%s:%s:sslmode=%s" % 
>> (config['prism_db_hostname'][0], config['prism_db_database'][0], 
>> config['prism_db_username'][0], config['prism_db_password'][0], 
>> config['prism_db_sslmode'][0]))
> 
> Are you sure you're not getting an error here already? I'm getting:
> 
> pg.InternalError: FATAL:  ungültige Kommandozeilenargumente für 
> Serverprozess
> TIP:  Versuchen Sie »postgres --help« für weitere Informationen.

No, I'm pretty sure - maybe your version of PostgreSQL is compiled 
without SSL support? Or you do not have a recent enough version of 
Postgres (I'm using 8.3)? When using the "sslmode" option in psql for 
example, it works fine.

> I think this is because the options here refer to server process 
> options, and sslmode is not one of them.

Yup it is :-)

psql "host=127.0.0.1 user=joe password=foo dbname=prismpp_sijsbaue 
sslmode=disable"

Works like a charm (on the remote DB I use sslmode=require, which also 
works). See also 
http://www.postgresql.org/docs/8.2/static/libpq-connect.html

> The problem is that PyGreSQL uses the PQsetdbLogin function instead of 
> the newer PQconnectdb which provides more options inculding sslmode. But 
> there is a workaround for passing the newer options:
> 
> db = pgdb.connect(database=
>      "host=... dbname=... user=... password=... sslmode=require")

Alright, thank you. That works.

It's a kind of nasty workaround, though...


> Another workaround would be setting the PGSSLMODE environment variable.
> 
> But I think we should switch to using PQconnectdb in PyGreSQL.

Uhm, can't comment on that - I'm just a Python newbie. Must say I was 
*really* confused by the dozens of different Postgres/Python APIs. Well 
I'm slowly getting there ;-)

Thanks again,
Regards,
Johannes
_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql

Reply via email to