Skip site navigation (1) Skip section navigation (2)

Re: Seeking PyGreSQL help

From: "Alastair G(dot) Hogge" <agh(at)tpg(dot)com(dot)au>
To: darcy(at)PyGreSQL(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Seeking PyGreSQL help
Date: 2003-08-05 10:09:47
Message-ID: 200308052009.47746.agh@tpg.com.au (view raw or flat)
Thread:
Lists: pgsql-interfaces
On Tuesday, 05 August 2003 19:10, D'Arcy J.M. Cain wrote:
> On Tuesday 05 August 2003 04:16, Alastair G. Hogge wrote:
> > I'm running PostgreSQL-7.3.3_1 on FreeBSD 5.0-CURRENT. I'm trying to use
> > python to interface with my database. I'm using Python-2.3 and
> > py23-PyGreSQL-7.3.3_1 from the FreeBSD ports tree.
> >
> > My problem is when I try to connect to the database.
> > Following is how the problem occurs:
> > <error>
> > #python
> >
> > >>>import _pg
> > >>>db = _pg.connect("mydb", "myhost")
> >
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> > _pg.error: could not connect to server: Connection refused
> >         Is the server running on host myhost and accepting
> >         TCP/IP connections on port 5432?
>
> What happens if you do 'db = _pg.connect("mydb")' from python or 'psql -h
> myhost' from the command line?  I suspect that your problem will reverse. 
> Bt default PostgreSQL does not run on a TCP/IP port.  You have to turn that
> on from the config file.  Don't forget pg_hba.conf if you change that.
Hello Darcy,

Thanks for help. The problem was in pgsql/data/postgresql.conf. I needed to 
change "#tcpip_socket = false" to "tcpip_socket = true"
I know am able to access my database from within Python, hwover when I try the 
python an cgi script I get an internet server error. Is there more options I 
should know about?




In response to

Responses

pgsql-interfaces by date

Next:From: Alastair G. HoggeDate: 2003-08-05 12:41:10
Subject: Re: Seeking PyGreSQL help
Previous:From: D'Arcy J.M. CainDate: 2003-08-05 09:10:39
Subject: Re: Seeking PyGreSQL help

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group