can't connect to postgresql using pygresql

Lee Harr missive at frontiernet.net
Tue Sep 11 17:38:02 EDT 2001


On 11 Sep 2001 13:24:26 -0700, rdack <rdacker at pacbell.net> wrote:
> rdacker at pacbell.net (rdack) wrote in message news:<644f6688.0109110958.284cc26d at posting.google.com>...
>> using pygresql-3.2, postgresql-7.1.3, mac os x 10.0?, g4
>> 
>> i can import _pg, but get error on connect:
>> >>>db=_pg.connect('tt1', 'localhost')
>> _pg.error: PQconnectPoll() -- connect() failed: Connection refused
>>         Is the postmaster running (with -i) at 'localhost'
>>         and accepting connections on TCP/IP port 5432?
>> 
>> port# problem? how do i determine what port postgresql is waiting on?
>> could it be a path problem? i can run psql and see my db from the
>> directory python is running from.
>> 
>> anything else i could check?
> 
> that is the default port for postgresql. 
> i tried:
>>>>db=_pg.connect('tt1')
> 
> and that worked. whew!
> it didn't like 'localhost'?


By including the 'localhost' you would be trying to connect over
a TCP/IP socket rather than a unix domain socket.

To make that work, you would need to restart the postmaster and
use the -i flag.

Be aware of the security implications of doing that.




More information about the Python-list mailing list