Yasser Shakoor wrote:
> Hi all
> 
> I am trying the same code on 2 different machines on one machine it is
> running ok and on the other machine it is giving strange kind of error,
> i have tried every thing but was not able to sort thois out so i thought
> to take help from you people.
> #!/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=webstatinfo;host=database.webstar.co.uk",
> "anila", "bdjx14eq");
> # 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_doma...@$this_domain\n";
>                 $i++;
>         }
>         $numweb = $i;
>         $result->finish;
>         $conn->disconnect;
> 
> The out put on the machine where i am getting the error is as below:
> 
> I have connected to the database webstatinfo
> GETTING DATA FROM DATABASE
> DBD::Pg::st execute failed: function requires at least protocol version
> 3.0 at ./analogscriptdaily line 34.
> DBD::Pg::st fetchrow failed: no statement executing
> at ./analogscriptdaily line 37.
> 
> 
> There is no problem in connecting to the database the line number on
> which error is coming up is:
> $result->execute;
> 
> i have tried uninstalling the DBI and DBD module and installing it from
> cpan but still getting the same error any help in this matter will be
> appreciated.
> 
> 

I don't really use postgres but I'd search for "function requires at
least protocol version 3.0" which threw up for me:

http://www.mail-archive.com/[email protected]/msg43720.html
http://archives.postgresql.org/pgsql-hackers/2004-10/msg00133.php

and I'd guess upgrading your postgres client libraries may help

but that is just a guess.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Reply via email to