Re: [INTERFACES] ack... problems with Pg, please advise. - Mailing list pgsql-interfaces

From Eric Enockson
Subject Re: [INTERFACES] ack... problems with Pg, please advise.
Date
Msg-id 374576CC.ED1C7330@cloudband.com
Whole thread Raw
List pgsql-interfaces
Eric Enockson wrote:

> Re: [INTERFACES] ack... problems with Pg, please advise.
>
>      From: Kevin Lo <jwlo@ms11.hinet.net>
>      To: jeff <jeffers@hctc.com>, pgsql-interfaces@postgreSQL.org
>      Subject: Re: [INTERFACES] ack... problems with Pg, please advise.
>      Date: Tue, 09 Feb 1999 13:45:14 +0800
>
> Jeff wrote:
>
> > hello, i just installed postgreSQL and it works great, i imported my
> db
> > and it works great with the psql interface, and i even can access it
> > from the shell with a perl script. but when i cut and paste the code
> > into a cgi, it returns nulls (albiet the appropriate number of nulls).
>
> > here is my code, what am i doing wrong? thanks.
> >
> > <begin code snippet>
> >
> > unless ($a) {$a="Metallica";}
> >
> > $conn = Pg::connectdb("dbname=tempest");
> > (PGRES_CONNECTION_OK eq $conn->status )
> >     and print "Pg::connectdb ........... ok<br>"
> >     or  die   "Pg::connectdb ........... not ok: ",
> $conn->errorMessage;
> >
> > # this part works, as the "ok" message is shown on the page...
> >
> > $result = $conn->exec("SELECT title from cds where artist='$a'");
>
> >From the DBI module documentation:
>
>     Note that prepare should never execute a statement,
>
> so this should be
>
>   $rc = $dbh->do("SELECT title from cds where artist='$a'")
>      or die $DBI::errstr;
   I think that this answer has nothing to do with the question asked
as the Pg perl module interface to postgres does not require DBI
installation in order to work.  At least i have installed it without such
and not gotten any errors.  Maybe that is my problem, but i don't
think so as the man page for Pg mentions nothing about it.

>
> >   while ( @row=$result->fetchrow ) {
> >          print "@row";
> >          print "<br>\n";
> >                   }
> > <end code snippet>
> >
> >         it returns the correct number of <br>s, but prints nothing,
> @rows
> > appear to be null. any ideas?
>
> BTW, would you check the log file of httpd server to see if any fails?
>
> Regards,
> Kevin.
       The problem i am having is that i connect to a database and then
try to use the conn object to print the name, a la;
    $conn = Pg::connectdb("dbname=$dbname");    $vrf_dbname = $conn->db;    print "conn->db=$vrf_dbname <BR> \n";

result:
   conn->db=   conn->status=PGRES_CONNECTION_OK
   and the name is empty.  Other problems happen as well using the
conn object to exec commands and such.  Like the previous poster
everything is fine through psql interface, it's my cgi's or rather
mod_perl scripts that are hosing up.  I am running apache on solairs 2.7
and perl 5.005_02 and the Pg module that ships with postgres 6.4.2, i'll
downloaded the latest and install it, then hopefully like most
perl modules i'll get a make test option and it might tell me
something.  However i would appreciate any help from others using
Pg perl interface to postgres in cgi's or mod_perls.  Also comments such
as everyone uses the db interfaces and your on your own would help
as well because they would make me switch.
   Ok thanks and please help






pgsql-interfaces by date:

Previous
From: José Soares
Date:
Subject: Re: [INTERFACES] lock row
Next
From: Dustin Engelhaupt
Date:
Subject: Using the Perl5 interface on another server