Perl DBI issue

From: "Peter Darley" <pdarley(at)kinesis-cem(dot)com>
To: "Pgsql-General" <pgsql-general(at)postgresql(dot)org>
Subject: Perl DBI issue
Date: 2005-06-22 19:34:12
Message-ID: PDEOIIFFBIAABMGNJAGPGENMDNAA.pdarley@kinesis-cem.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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();

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2005-06-22 19:50:10 Re: [HACKERS] [PATCHES] Removing Kerberos 4
Previous Message Ed L. 2005-06-22 18:18:26 Re: Clustering and replication options