Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Error Message "Can't load 'C:/Perl64/lib/auto/DBD/Oracle/Oracle.dll" While Connecting to Oracle

by TonyByorick (Initiate)
on Jan 25, 2014 at 22:00 UTC ( [id://1072094]=perlquestion: print w/replies, xml ) Need Help??

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

I am trying to configure an Oracle connection from Perl running on a Windows 7 desktop to an Oracle 11g database running on Linux; however the database connection step is failing.

The following line of perl code fails:

use DBD::Oracle;

The full error message is:

Can't load 'C:/Perl64/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:%1 is not a valid Win32 application at C:/Perl64/lib/DynaLoader.pm line 191. at C:\go\perl\tracker\pingOracle.pl line 17.

The following line of perl code fails with a similar error message:

$dbh = DBI->connect("dbi:Oracle:host=$host;sid=$sid;port=$port", $user, $passwd);

The version of my Perl install is:

# C:\Perl64\bin>perl -v # # This is perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32 +-x64-multi-thread # (with 1 registered patch, see perl -V for more detail) # Binary build 1603 [296746] provided by ActiveState http://www.Active +State.com # Built Mar 13 2013 13:31:10

I'm running 64 bit Windows and 64 bit Perl. Is it possible the DBD loader is failing because it is trying to load a 32 bit driver?

The Oracle 11.2 client package of drivers is installed on the same desktop PC and these drivers successfully connect my Toad client to the Oracle database.

From the Perl script error message above, it appears Perl is trying to load a driver that was installed along with ActiveState Perl.

Should I try to configure Perl to use the Oracle 11.2 drivers? Or should Perl be loading drivers installed from ActiveState?

Any help or thoughts would greatly appreciated. -Tony

  • Comment on Error Message "Can't load 'C:/Perl64/lib/auto/DBD/Oracle/Oracle.dll" While Connecting to Oracle
  • Select or Download Code

Replies are listed 'Best First'.
Re: Error Message "Can't load 'C:/Perl64/lib/auto/DBD/Oracle/Oracle.dll" While Connecting to Oracle
by bulk88 (Priest) on Jan 26, 2014 at 05:22 UTC
    You tried to load a 32 bit DLL into a 64 bit process. Either "C:/Perl64/lib/auto/DBD/Oracle/Oracle.dll" is a 32 bit DLL (very unlikely), or whatever DLL Oracle.dll links to, and was found in %PATH, was a 32 bit DLL. Use the "profiling" feature of Dependency Walker to figure it out.
Re: Error Message "Can't load 'C:/Perl64/lib/auto/DBD/Oracle/Oracle.dll" While Connecting to Oracle (not valid)
by tye (Sage) on Jan 26, 2014 at 03:20 UTC
    is not a valid Win32 applicatio­n

    ...likely means a file has been corrupted. My guess is that C:/Perl64­/lib/auto/­DBD/Oracle­/Oracle.dl­l got corrupted. But that isn't even a confident guess. But it is the direction that I would direct further investigation.

    - tye        

        Reading the linked thread, I didn't see a clear cause clearly called out, but it looked to me like the problem in that case was that the DLL's base address conflicted with some other DLL's base address.

        Other likely types of "corruption" could be mixing 64-bit and 32-bit components. Yes, I realize that "corruption" isn't the correct term for any of this. ;)

        One next step I might do is watch what the perl process is doing when this fails. Is there a sysinternals-like process monitor that works on Windows 7 these days? Even a file system monitor might help in pointing at which library is the real problem.

        On Unix, I'd ask lsof to tell me what other DLLs are loaded so I could just check for conflicting base addresses (seems a poor system to be vulnerable to such -- but maybe I misunderstood the real root cause in that other thread). I'm not sure how to do the equivalent on Windows, but that shouldn't be hard to look up.

        (Updated: To move the last sentence of the 2nd-to-last paragraph to be the last sentence of the last paragraph, as I had originally intended.)

        - tye        

Re: Error Message "Can't load 'C:/Perl64/lib/auto/DBD/Oracle/Oracle.dll" While Connecting to Oracle
by Anonymous Monk on Jan 26, 2014 at 01:09 UTC

    The Oracle 11.2 client package of drivers is installed on the same desktop PC and these drivers successfully connect my Toad client to the Oracle database.

    unlikely story :) either you're missing %ORACLE_HOME% in your env

    or the DBD/Oracle.dll is linked against something not compatible with what you have in %PATH% ( and %ORACLE_HOME%

    To figure it out you could use depends.exe /c /f:1 /pb /ot:temp.txt ... perl.exe foo.pl

    or open DBD/Oracle.dll in depends.exe

Re: Error Message "Can't load 'C:/Perl64/lib/auto/DBD/Oracle/Oracle.dll" While Connecting to Oracle
by karlgoethebier (Abbot) on Jan 26, 2014 at 13:34 UTC

    Seems there is something about this issue in the manual of DBD::Oracle:

    Most importantly you will have to add the Instant Client directory to your path like this c:\DBD-Oracle>path = c:\IC_11;%path% If you do not do this step you will run into the dreaded Can't load 'C:/Perl/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:%1 is not a valid Win32 application at C:/Perl/lib/DynaLoader.pm line 202. If you do not do this step you will run into the dreaded Can't load 'C:/Perl/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:%1 is not a valid Win32 application at C:/Perl/lib/DynaLoader.pm line 202

    Don't know if this helps. Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      Thanks for the many thoughtful responses to my question.

      I have not found a root cause for the problem however, I have found a workaround by installing the 32 bit version of ActiveState Perl and using it rather than the 64 bit version.

      With 32 bit Perl, "$dbh = DBI->connect("dbi:Oracle:host=$host;sid=$sid;port=$port", $user, $passwd);" performs without complaining and then executes SQL and returns the answer set.

      -Tony

        I have found a workaround by installing the 32 bit version of ActiveState Perl and using it rather than the 64 bit version

        This is further indication that the oracle dll that Perl/lib/auto/DBD/Oracle/Oracle.dll tries to load is 32-bit (as already suggested by others) and therefore can't be loaded by a 64-bit perl.

        Cheers,
        Rob
Re: Error Message "Can't load 'C:/Perl64/lib/auto/DBD/Oracle/Oracle.dll" While Connecting to Oracle
by Anonymous Monk on Aug 03, 2015 at 21:50 UTC
    I downloaded MSFT Dependency Walker> https://support.microsoft.com/en-us/kb/256872 . Then opened auto\DBD\Oracle\Oracle.dll, and was shown which MSFT DLLs were the problem. (in this case Oracle DLLs were fine). Nice tool.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1072094]
Approved by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-24 22:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found