From: | samik(at)cae(dot)wisc(dot)edu (Samik Raychaudhuri) |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Showing Database connection error through perl |
Date: | 2002-02-12 02:40:40 |
Message-ID: | fbf5e750.0202111840.39545d29@posting.google.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
I have got a problem regarding showing my database connection errors
through CGI program. I have got the following lines of code:
---------------------------------------------
#!/s/std/bin/perl
use lib "/s/postgresql-7/perl5";
use DBI;
$dbh=DBI->connect("dbi:Pg:dbname='src';host='...';port=5432","sam","")
|| die "Content-type: text/plain\n\nCouldn't connect to
DB: ".DBI::errstr. " and something.\n";
----------------------------------------------
When I run the program from the command prompt, and if it can't
connect to the database, it shows the reason of the error, as shown
below:
----OUTPUT---------------
DBI->connect failed: FATAL 1: user "sam" does not exist at dbex.pl
line 8
Content-type: text/plain
Couldn't connect to DB: FATAL 1: user "sam" does not exist and
something.
-----------------
But when I try to run the same program through web-browser, it
(web-log) doesn't show the error string. The output I get is:
----OUTPUT----
DBI->connect failed: 1 at /var/home/www/cgi-public/samik/test/dbex.pl
line 8
Content-type: text/plain
Couldn't connect to DB: 1 and something.
------------------
Can anyone suggest what might be the error, or what I should do to get
the full error string through the browser/web-log.
Thanks and regards.
-Samik
From | Date | Subject | |
---|---|---|---|
Next Message | Lamar Owen | 2002-02-12 03:09:07 | Re: postgresql -- what's in a name? |
Previous Message | Rich Shepard | 2002-02-12 02:36:05 | Re: 7.2 PGDG RPMS and readline 4.0 |