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

I am currently working on a Windows XP platform that runs Tomcat 6 locally (for testing purposes) and Perl 5.8. I have a CGI script that connects to a DB2 database via DBI and runs some standard queries. The script executes without any errors from the command prompt and outputs the desired results within the command prompt. However, when running this same script from the browser I get the following error:

install_driver(DB2) failed: Can't load 'C:\Program Files(x86)\Perl\sit +e\lib\auto\DBD\DB2\DB2.dll' for module DBD::DB2: load_file:The specif +ied module could not be found at C:/Program Files(x86)/Perl/lib/DynaL +oader.pm line 230 at (eval 6) line 3 Compilation failed in require at (eval6) line 3. Perhaps a required shared library or dll isn't installed where expecte +d at C:\Developer\apache-tomcat-6.0.32\webapps\ROOT\WEB-INF\cgi\test. +cgi line 28

Right before line 230 in the DynaLoader.pm file this can be found:

#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.

...and line 230 reads:

my $libref = dl_load_file($file, $module->dl_load_flags) or croak(Can't load '$file' for module $module: ".dl_error());

I've never encountered this type of error before and would really appreciate some suggestions as this is somewhat of a time- sensitive project.

Replies are listed 'Best First'.
Re: DynaLoader.pm line 230 error::install_driver(DB2) failed
by Anonymous Monk on Aug 19, 2011 at 03:32 UTC

    If you run DependencyWalker on lib\auto\DBD\DB2\DB2.dll you'll find out that it relies on .... when apache (not a browser) runs your program, it doesn't know where to find the dll files DB2.dll depends on

    Its just a matter of editing %PATH% for apache (or the user it runs as), and whatever DB2 specific env vars (like DB2_HOME)

    You'll learn soon enough not to bother looking inside DynaLoader.pm (the error message ought to mention this, but hey :)