DBI connection problem

From: "Ji Li" <jli(at)faxtel(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: DBI connection problem
Date: 1999-05-27 17:08:54
Message-ID: 000701bea863$99c27800$a49577d8@netiger.faxtel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, all
I am trying to write Perl script using DBI module to manupulate the database
on our virtual server.

I wrote the following code:

#! /usr/bin/perl5

use DBI;
$dbHandle = DBI->connect("DBI:Pg:dbname=best",'','') or $DBI::errstr;
$sql ="SELECT * FROM sample";
$statementHandle = $dbHandle->prepare($sql);
$statementHandle->excute() || die $statementHandle->errstr;

$arrayRef = $statementHandle->fetchall_arrayref;
$dbHandle->disconnect();

print $arrayRef ;

after compiling, I got the following error message:

connectDB() failed: Is the postmaster running and accepting connections at 'UNIX
Socket' on port '5432'?
at sample.pl line 4

but when I run
% psql

in the shell, everything works just OK.

Why my script cannot connect to the database? What I need to do for this?

Thanks a lot.

James

Browse pgsql-general by date

  From Date Subject
Next Message Peter T Mount 1999-05-27 17:24:50 Re: [INTERFACES] Re: [GENERAL] JDBC and insert - stack overflow
Previous Message Bruce Momjian 1999-05-27 15:17:00 Re: [GENERAL] 6.4.2 on DEC Alpha