Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > cgi DBI Oracle errors

Reply
Thread Tools

cgi DBI Oracle errors

 
 
philip.kingsten@yahoo.com
Guest
Posts: n/a
 
      01-21-2008
Hello,
How can I get hold of the errors from a CGI below. It works fine on
the command line - but fails silently when invoked via cgi? The query
just ask for a describe on a table.
Thanks for your help...

Phil

#!/usr/local/bin/perl

use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use CGI ':standard';
use DBI;
my $dbh = DBI->connect( 'dbi:Oracle:FRED',
'bert', 'bert', { RaiseError => 1, AutoCommit => 0 }
) || die "Database connection not made: $DBI::errstr";
....

 
Reply With Quote
 
 
 
 
philip.kingsten@yahoo.com
Guest
Posts: n/a
 
      01-21-2008
On 21 Jan, 11:32, philip.kings...@yahoo.com wrote:
> Hello,
> How can I get hold of the errors from a CGI below. It works fine on
> the command line - but fails silently when invoked via cgi? The query
> just ask for a describe on a table.
> Thanks for your help...
>
> Phil
>
> #!/usr/local/bin/perl
>
> use strict;
> use warnings;
> use CGI::Carp qw(fatalsToBrowser);
> use CGI ':standard';
> use DBI;
> my $dbh = DBI->connect( 'dbi:Oracle:FRED',
> 'bert', 'bert', { RaiseError => 1, AutoCommit => 0 }
> ) || die "Database connection not made: $DBI::errstr";
> ...


I now know that it is this last line that causes the problem - I get a
"cannot execute contact your sysadmin from the web server" if I
include this line - and no error if I inlcud ethe line above.
As this works on the commandline but not here I suspect the
environment - Please how can I dump the environment?

 
Reply With Quote
 
 
 
 
Tad J McClellan
Guest
Posts: n/a
 
      01-21-2008
<> wrote:
> On 21 Jan, 11:32, philip.kings...@yahoo.com wrote:
>> Hello,
>> How can I get hold of the errors from a CGI below. It works fine on
>> the command line - but fails silently when invoked via cgi? The query
>> just ask for a describe on a table.
>> Thanks for your help...
>>
>> Phil
>>
>> #!/usr/local/bin/perl
>>
>> use strict;
>> use warnings;
>> use CGI::Carp qw(fatalsToBrowser);
>> use CGI ':standard';
>> use DBI;
>> my $dbh = DBI->connect( 'dbi:Oracle:FRED',
>> 'bert', 'bert', { RaiseError => 1, AutoCommit => 0 }
>> ) || die "Database connection not made: $DBI::errstr";
>> ...

>
> I now know that it is this last line that causes the problem - I get a
> "cannot execute contact your sysadmin from the web server" if I
> include this line - and no error if I inlcud ethe line above.
> As this works on the commandline but not here I suspect the
> environment -



I suspect that your CGI program does not run as the same user as
when you tried it from the command line...

Find out what user it is running as:

warn "user is ", scalar(getpwuid $<), "\n";


> Please how can I dump the environment?


print "$_ => $ENV{$_}\n" for sort keys %ENV;


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
install_driver(Oracle) failed: Can't load 'C:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:The specified procedure could not be found at C:/Perl/lib/DynaLoader.pm line 230. Feyruz Perl Misc 4 10-14-2005 06:47 PM
how to load a picture to an oracle database with theLoad a pictureto Oracle with DBI perl module Vincent Le-Texier Perl Misc 1 12-03-2004 03:29 PM
DBI Mysql storing DBI:binary, trouble with character 26 Jerome Hauss Ruby 0 10-13-2004 03:04 PM
DBI and DBI::Oracle packages configuration ulloa Perl 1 07-22-2004 05:52 PM
Mason, DBI, and DBI::Pg Asby Perl Misc 0 07-24-2003 09:04 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57