http://www.perlmonks.org?node_id=16738

johnmbd has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to get a connection to an Oracle DB. It works via the command line but craps out through the browser. Here is the code
use CGI qw(:all); use CGI::Carp qw(fatalsToBrowser); use strict; use DBI; print header; my $dbh = DBI->connect("dbi:Oracle:host=pikachu;sid=DEVORANT", "so", " +so") or die "Can\'t connect to -- $DBI::errstr\n"; print "hello world";
Here is what gets dumped to the browser:
Content-type: text/html Software error: install_driver(Oracle) failed: [Tue Jun 6 14:53:43 2000] C:\InetPub\cgi-bin\spmc\search.pl: [Tue Jun 6 14:53:43 2000] C:\InetPub\cgi-bin\spmc\search.pl: Can't load 'C:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:Access is denied at C:/Perl/lib/DynaLoader.pm line 169. [Tue Jun 6 14:53:43 2000] C:\InetPub\cgi-bin\spmc\search.pl: [Tue Jun 6 14:53:43 2000] C:\InetPub\cgi-bin\spmc\search.pl: [Tue Jun 6 14:53:43 2000] C:\InetPub\cgi-bin\spmc\search.pl: [Tue Jun 6 14:53:43 2000] C:\InetPub\cgi-bin\spmc\search.pl: at (eval 7) line 3 at C:\InetPub\cgi-bin\spmc\search.pl line 17 For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
I've checked out the DynaLoader.pm file at line 169 but it tells me (just above in a comment) that "Many dynamic extension loading problems will appear to come from this section of code: XYZ failed at line 123 of DynaLoader.pm. Often these errors are actually occurring in the initialisation C code of the extension XS file. Perl reports the error as being in this perl code simply because this was the last perl code it executed." I can't tell if this is the case. If it is, can I work around it, if it isn't can anyone help me?

Replies are listed 'Best First'.
Re: DBI Oracle and our pal IIS
by BBQ (Curate) on Jun 08, 2000 at 03:05 UTC
    Try adding some of the below to you're script before you actually connect to the database.
    # where you're Oracle home is $ENV{'ORACLE_HOME'} = 'E:/Oracle/OAS408'; $ORACLE_HOME = $ENV{'ORACLE_HOME'}; # if you use Oracle Application Server 4.x or > $ORAWEB_HOME = "$ORACLE_HOME/ows/4.0"; # if you want ñ ã á ü and chars of the sort. $ENV{NLS_LANG} = 'american_america.we8iso8859p1'; $ENV{ORA_NLS} = "$ORACLE_HOME/ocommon/nls/admin/data"; $ENV{ORA_NLS32} = "$ORACLE_HOME/ocommon/nls/admin/data";
    It seems that the IUSR_MACHINE user doesn't know where to find Oracle Pro*C. You do have Pro*C installed, don't you?
Re: DBI Oracle and IIS
by FirstCool (Initiate) on Mar 31, 2003 at 22:28 UTC
    I had same problem. Solution was to give Read & Execute permissions to the c:\orant directories to the network/local account that the web server uses. The perl scripts need to go outside of the perl directories to use Oracle stuff, so give the web server permission to execute the Oracle stuff.

    The reason it worked from the command line was that I was using my own network account that already had permissions to the Oracle directories.

    Up until recently, I did troubleshooting by logging on to the web server using the account that the web server uses. Then use Windows Explorer to verify that the web server can see the same things I can see when logged in as myself. A recent "lockdown" tool removed the ability to log on locally to the web server itself, but I can still log on to another computer and do the testing.

    Hey, my first post! FirstCool

Re: DBI Oracle and our pal IIS
by t0mas (Priest) on Jun 07, 2000 at 12:08 UTC
    Your pal IIS is running with IUSR_<SERVERNAME> security credentials. You get "Access is denied". Maybe there is a security problem.
    I use DBI with ActivePerl quite alot. It works very well using CGI, but I've never got PerlEx working with DBI though.

    /brother t0mas