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 AC94BD1CA43 for ; Tue, 5 Aug 2003 09:10:48 +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 92451-08 for ; Tue, 5 Aug 2003 06:09:31 -0300 (ADT) Received: from druid.net (druid.net [216.126.72.98]) by svr1.postgresql.org (Postfix) with ESMTP id 1BEDBD1CA33 for ; Tue, 5 Aug 2003 06:10:37 -0300 (ADT) Received: by druid.net (Postfix, from userid 1000) id 7DA671A78; Tue, 5 Aug 2003 05:10:40 -0400 (EDT) From: "D'Arcy J.M. Cain" Reply-To: darcy@PyGreSQL.org To: "Alastair G. Hogge" , pgsql-interfaces@postgresql.org Subject: Re: Seeking PyGreSQL help Date: Tue, 5 Aug 2003 05:10:39 -0400 User-Agent: KMail/1.5.2 References: <200308051816.06256.agh@tpg.com.au> In-Reply-To: <200308051816.06256.agh@tpg.com.au> Organization: PyGreSQL Development Group MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200308050510.39725.darcy@PyGreSQL.org> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/21 X-Sequence-Number: 4375 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. -- D'Arcy J.M. Cain PyGreSQL Development Group http://www.PyGreSQL.org