CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
DBD::Pg::st execute failed: function requires at least protocol version 3.0

 



yasir
New User

Jan 4, 2010, 2:57 AM

Post #1 of 1 (5544 views)
DBD::Pg::st execute failed: function requires at least protocol version 3.0 Can't Post

If i run the below code i am getting this error:
DBD::Pg::st execute failed: function requires at least protocol version 3.0 at ./analogscriptdaily line 34.
The line 34 is:
$result->execute;

The connection with the database is established only problem arises when trying to execute the result set any help will be appreciated.

The same code is working on the other machine, so i problem seems to with the DBI or DBD module which i have already tried.

#!/usr/bin/perl
#
# This script will produce daily web access statistic reports
#
#

use DBI;

# if today is the first of the month then don't run :
$day = `date +%d`;
if ($day=="01") {
exit(0);
} else {

# Connect to database
$conn = DBI->connect("dbi:Pg:dbname=test;host=test.yasir.co.uk", "test", "tredftjg");
# test to see if connecting!!
if ( !defined $conn ) {
die "Cannot connect to database!\n";
}

print ("I have connected to the database webstatinfo\n");

# Obtain all the data from the database and put into a series of arrays
# @domain1 is an array containing all the data for the first domain in
# the postgres database, @domain2 for the second domain etc..

print ("GETTING DATA FROM DATABASE\n");
$querystring=("select output_filepath, hostname, logfile from loginfo");
$result = $conn->prepare($querystring);
if ( !defined $result ) {
die "Cannot prepare statement: $DBI::errstr\n";
}
$result->execute;

$i=0;
while ( @row = $result->fetchrow()) {
$this_domain = "domain$i";
@$this_domain = @row;
print "$this_domain=@$this_domain\n";
$i++;
}
$numweb = $i;
$result->finish;
$conn->disconnect;

Yasser

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives