Обсуждение: Trouble with PG.pm Interface via browser

Поиск
Список
Период
Сортировка

Trouble with PG.pm Interface via browser

От
harris justin
Дата:
Hello

I am developing an interface to Postgres via a browser and am
having trouble getting and perl scripts called from a "POST"
method to connect to the database.
When run from the command prompt the script will connect OK.
 When run from the browser nothing is returned and the request
times out after a period of time.
I am running postgres with SUSE 5.3.  The httpd daemon runs
under user:wwwrun group:daemon.  I have checked that under this
user ID I can connect to the database from the command line
but not from the browser. I have a browser interface using the C Library's running Ok under the same UID and group.

I took the following code from one of the posted messages to
check that I was not missing anything obvious. Is there something
obvious that I am missing here.

Can anyone help?

#!/usr/bin/perl

use Pg;

# read (STDIN, $cmdline, $ENV{'CONTENT_LENGTH'});
$cmdline = <STDIN>;

@pairs = split (/&/, $cmdline);
foreach $pair (@pairs){
($name, $value) = split (/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack ("C", hex($1))/eg;
}
print "Content-type:text/html\n\n";

print <<EOM;
<HTML>
<BODY>
<BR>
EOM


$con=PQsetdb('','','','','soft');
$errmsg = PQerrorMessage ( $con );
if ($errmsg ne '')
{
print ($errmsg);
}

PQfinish($con);

print <<EOM;
</BODY>
</HTML>
EOM

JDBC

От
mail@numanet.com
Дата:
Does anyone know of a source for some sample code for using jdbc or an
online tutorial?

Re: [GENERAL] Trouble with PG.pm Interface via browser

От
Gilles Darold
Дата:
harris justin wrote:

> Hello
>
> I am developing an interface to Postgres via a browser and am
> having trouble getting and perl scripts called from a "POST"
> method to connect to the database.
> When run from the command prompt the script will connect OK.
>  When run from the browser nothing is returned and the request
> times out after a period of time.
> I am running postgres with SUSE 5.3.  The httpd daemon runs
> under user:wwwrun group:daemon.  I have checked that under this
> user ID I can connect to the database from the command line
> but not from the browser. I have a browser interface using the C Library's running Ok under the same UID and group.
>

Are you running postmaster with the -i option  in your startup script ?

Gilles Darold


Re: [GENERAL] JDBC

От
Peter Mount
Дата:
On Sat, 7 Aug 1999 mail@numanet.com wrote:

> Does anyone know of a source for some sample code for using jdbc or an
> online tutorial?

There's an entire directory of examples included with the source code.

Peter

--
       Peter T Mount peter@retep.org.uk
      Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
 Java PDF Generator: http://www.retep.org.uk/pdf