X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 27CD2D1CA03 for ; Tue, 5 Aug 2003 10:09:58 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 94383-10 for ; Tue, 5 Aug 2003 07:08:42 -0300 (ADT) Received: from mail3.tpgi.com.au (mail.tpgi.com.au [203.12.160.59]) by svr1.postgresql.org (Postfix) with ESMTP id B7642D1C9FF for ; Tue, 5 Aug 2003 07:09:45 -0300 (ADT) Received: from 192.168.0.4 (220-244-72-6.tpgi.com.au [220.244.72.6]) by mail3.tpgi.com.au (8.11.6/8.11.6) with ESMTP id h75A9fU20320 (using TLSv1/SSLv3 with cipher RC4-MD5 (128 bits) verified NO); Tue, 5 Aug 2003 20:09:42 +1000 From: "Alastair G. Hogge" To: darcy@PyGreSQL.org, pgsql-interfaces@postgresql.org Subject: Re: Seeking PyGreSQL help Date: Tue, 5 Aug 2003 20:09:47 +1000 User-Agent: KMail/1.5.3 References: <200308051816.06256.agh@tpg.com.au> <200308050510.39725.darcy@PyGreSQL.org> In-Reply-To: <200308050510.39725.darcy@PyGreSQL.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200308052009.47746.agh@tpg.com.au> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/15 X-Sequence-Number: 4369 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: > > > > #python > > > > >>>import _pg > > >>>db = _pg.connect("mydb", "myhost") > > > > Traceback (most recent call last): > > File "", 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?