cgi DBI Oracle errors

Discussion in 'Perl Misc' started by philip.kingsten@yahoo.com, Jan 21, 2008.

  1. Guest

    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";
    ....
     
    , Jan 21, 2008
    #1
    1. Advertising

  2. Guest

    On 21 Jan, 11:32, 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?
     
    , Jan 21, 2008
    #2
    1. Advertising

  3. <> wrote:
    > On 21 Jan, 11:32, 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/"
     
    Tad J McClellan, Jan 21, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ulloa
    Replies:
    1
    Views:
    527
    Juha Laiho
    Jul 22, 2004
  2. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    956
    Mark Goldin
    Jan 17, 2004
  3. Jerome Hauss
    Replies:
    0
    Views:
    172
    Jerome Hauss
    Oct 13, 2004
  4. Vincent Le-Texier
    Replies:
    1
    Views:
    154
    Paul Lalli
    Dec 3, 2004
  5. Feyruz
    Replies:
    4
    Views:
    2,185
    Sherm Pendley
    Oct 14, 2005
Loading...

Share This Page