#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2016
    Posts
    5
    Rep Power
    0

    DBD::Oracle in browser


    I have a program using DBD::Oracle in perl. Runs fine at command line,
    can't get it to run in httpd as root, but not for any other user.I get the following error that is driving me nuts!

    install_driver(Oracle) failed: Can't locate DBD/Oracle.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl
    /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at (eval 3) line 3. Perhaps the DBD::Oracle perl module hasn't been fully installed,
    or perhaps the capitalisation of 'Oracle' isn't right. Available drivers: DBM, ExampleP, File, Gofer, Pg, Proxy, SQLite, Sponge, mysql.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Apr 2009
    Posts
    2,232
    Rep Power
    1296
    Where was DBD::Oracle installed?

    Do you have multiple perl installations on that box?

    Compare the difference in what's in @INC when run from the command line vs when run thru the web server.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2016
    Posts
    5
    Rep Power
    0
    thanks mong..

    i got result from cmd prompt below:
    /opt/perl/lib/5.10.0/x86_64-linux /opt/perl/lib/5.10.0 /opt/perl/lib/site_perl/5.10.0/x86_64-linux /opt/perl/lib/site_perl/5.10.0 .

    I am using below program
    Code:
    #!/usr/bin/perl
    use DBI;
    use CGI;
    BEGIN {push @INC, '/opt/perl/lib/site_perl/5.10.0/x86_64-linux/DBD/Oracle.pm'}
    print "Content-type: text/html\n\n";
    print "Hello, World.";
     ##"print qq(@INC\n)"
    $dbh = DBI->connect('dbi:...','...', '...') or die "Couldn't prepare 1st statement: ";
    $dbh->disconnect;
    and below are the results that is in debugger mode:
    Code:
    [test@test cgi-bin]$ perl -d test.cgi
    
    Loading DB routines from perl5db.pl version 1.3
    Editor support available.
    
    Enter h or `h h' for help, or `man perldebug' for more help.
    
    Scalar found where operator expected at test.cgi line 8, near "$dbh"
     at test.cgi line 8
            (Missing semicolon on previous line?)
     at test.cgi line 8
    syntax error at test.cgi line 8, near "$dbh "
    Execution of test.cgi aborted due to compilation errors.
     at test.cgi line 9
    Debugged program terminated.  Use q to quit or R to restart,
      use o inhibit_exit to avoid stopping after program termination,
      h q, h R or h o to get additional info.
    Can't ioctl TIOCGETP: Invalid argument
    Consider installing Term::ReadKey from CPAN site nearby
            at 302 Found
    Or use
            perl -MCPAN -e shell
    to reach CPAN. Falling back to 'stty'.
            If you do not want to see this warning, set PERL_READLINE_NOWARN
    in your environment.
     at /opt/perl/lib/site_perl/5.10.0/Term/ReadLine/readline.pm line 1730
            readline::SetTTY() called at /opt/perl/lib/site_perl/5.10.0/Term/ReadLine/readline.pm line 1580
            eval {...} called at /opt/perl/lib/site_perl/5.10.0/Term/ReadLine/readline.pm line 1580
            readline::readline('  DB<1> ') called at /opt/perl/lib/site_perl/5.10.0/Term/ReadLine/Perl.pm line 11
            Term::ReadLine::Perl::readline('Term::ReadLine::Perl=ARRAY(0xe40370)', '  DB<1> ') called at /opt/perl/lib/5.10.0/perl5db.pl line 6414
            DB::readline('  DB<1> ') called at /opt/perl/lib/5.10.0/perl5db.pl line 2227
            DB::DB called at /opt/perl/lib/5.10.0/perl5db.pl line 9451
            DB::fake::at_exit() called at /opt/perl/lib/5.10.0/perl5db.pl line 9022
            DB::END() called at test.cgi line 9
            eval {...} called at test.cgi line 9
    Last edited by requinix; November 25th, 2016 at 12:03 PM. Reason: redact dbi->connect info
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,782
    Rep Power
    4300
    I think I see your problem. Do me a favor and run this command at your prompt:
    Code:
    which perl
    and paste the output below.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Apr 2009
    Posts
    2,232
    Rep Power
    1296
    The push statement in the BEGIN block is wrong. The @INC array holds directory paths which do not include the module name. You should remove that BEGIN block. If you truly do need to manually add the path to the DBD::Oracle module to the @INC array, then that tells me that the module wasn't installed correctly for the perl version you're using to run the script. When adding paths to @INC, it's better to use the lib pragma instead of the BEGIN block.

    To connect to an oracle database, besides the DBD::Oracle module, you'll also need to have several environment variable set. Did you set those variables?
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2016
    Posts
    5
    Rep Power
    0
    Thanks everyone for your help , I have fixed this issue .. really appreciate your help

IMN logo majestic logo threadwatch logo seochat tools logo