Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f76L2K631546 for ; Mon, 6 Aug 2001 17:02:20 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id f76Kt1W92714 for pgsql-sql@postgresql.org; Mon, 6 Aug 2001 16:55:01 -0400 (EDT) (envelope-from news) From: Allan Engelhardt X-Newsgroups: comp.databases.postgresql.sql Subject: Re: prob with PERL/Postgres Date: Mon, 06 Aug 2001 21:54:59 +0100 Organization: http://cybaea.com/ Message-ID: <3B6F0423.3C9D2C12@cybaea.com> References: <3B6EA444.13097.C20296@localhost> X-NNTP-Posting-Host: engelhardt.demon.co.uk:193.237.12.86 X-Complaints-To: abuse@demon.net X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.7 i686) X-Accept-Language: en MIME-Version: 1.0 To: Kristopher Yates Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 55 To: pgsql-sql@postgresql.org X-Archive-Number: 200108/68 X-Sequence-Number: 4289 1. I'm assuming that psql works fine? psql -h 127.0.0.1 mpact? 1b. Have you checked the port?? You ARE running postmaster with the '-i' option, aren't you? The recommended solutions are typically to use the DBI and DBD modules. Try man DBD::Pg. Alternatively: have you tried the setdbLogin method instead: $conn = Pg::setdbLogin($pghost, $pgport, $pgoptions, $pgtty, $dbname, $login, $pwd) Opens a new connection to the backend. The connection identifier $conn ( a pointer to the PGconn structure ) must be used in subsequent commands for unique identifica- tion. Before using $conn you should call $conn->status to ensure, that the connection was properly made. Closing a connection is done by deleting the connection handle, eg 'undef $conn;'. Hope this helps a little...... Allan Kristopher Yates wrote: > PERL SNIPPET: > > # build arrays from file (OMITTED) > > use Pg; > $dbhost='127.0.0.1'; > $dbname='mpact'; > #$connstr="dbname=$dbname"; > $connstr="host=$dbhost dbname=$dbname"; > $conn = Pg::connectdb($connstr); > > #more code related to date omitted > > $result=$conn->exec($sql); > (PGRES_COMMAND_OK eq $result->resultStatus) > or die $conn->errorMessage; > > WHY DO I GET PQsendQuery() -- There is no connection to the > backend. I have tried leaving host blank, using IP 127.0.0.1 and > hostname localhost. This script should work - the problem is > something with postgres but I dont know what. Any ideas out > there? Thanks, Kris > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html