Perl DBI issue - Mailing list pgsql-general

From Peter Darley
Subject Perl DBI issue
Date
Msg-id PDEOIIFFBIAABMGNJAGPGENMDNAA.pdarley@kinesis-cem.com
Whole thread Raw
Responses Re: Perl DBI issue
List pgsql-general
Folks,

    I just installed a new machine with Fedora Core 4 with PostgreSQL 8.0.3.  I
also installed DBI::Pg 1.41.  When I try to use a query with a placeholder
in it I get the error: "DBD::Pg::st execute failed: ERROR:  syntax error at
or near "$1" at character 1".  The same query with a value instead of a
placeholder works just fine.  The script follows this email.

    I can use exactly the same script to connect to PostgreSQL on this machine
from a different machine, and I can not connect from this machine to a
PostgreSQL install of 7.4.1.  It looks to me like there is some problem
between DBI::Pg and the client library.  While poking around I saw that all
the other machines have a libpq.so, but this new machine doesn't (it has a
libpq.so.4 and libpq.so.4.0 tho).  I don't know if that is significant.

    Any suggestions would be much appreciated.

Thanks,
Peter Darley


#!/usr/bin/perl

use DBI;
use strict;

my ($dbhCheck, $sthCheck, $Result);

$dbhCheck = DBI->connect("dbi:Pg:dbname=neo;host=production", 'user',
'password');
$sthCheck = $dbhCheck->prepare("SELECT COUNT(*) FROM Sample where
SurveyID=?");
$sthCheck->execute(316);
$Result = $sthCheck->fetchrow();
print "Sample has $Result members.\n";
$sthCheck->finish();
$dbhCheck->disconnect();


pgsql-general by date:

Previous
From: "Ed L."
Date:
Subject: Re: Clustering and replication options
Next
From: Greg Stark
Date:
Subject: Re: [HACKERS] [PATCHES] Removing Kerberos 4