DBD::Oracle and Windows 64bit

Apr 20, 2010 / By John Scoles

Tags: , , ,

I have successfully compiled and installed DBD::Oracle on Windows 2008 Server 64bit operating system today.

I used the latest version of DBD::Oracle 1.24, version 11.2.0.1.0 for 64bit Windows of Oracle’s
Instant Client Package – Basic along with the Instant Client Package – SQL*Plus and finally the Instant Client Package – SDK.

To get it to make and compile correctly I had to download Microsoft’s Visual Studio Ultimate

which should contain all the files you need. It is rather portly at 2+gb so you might want to grab lunch while you are downloading it.

After all the above downloading DBD::Oracle installed right out of the box.

All one has to do is select ‘Start Menu->All Programs->Microsoft Visual Studio 2010->Visual Studio Tools->Visual Studio x64 Win64 Command Prompt (2010)’
which will open a good old ‘dos’ window.

At this point CD to the directory where you downloaded DBD::Oracle

     c:DBD-Oracle

then set your ‘ORACLE_HOME to the Instant Client directory

     c:DBD-Oracle set ORACLE_HOME=c:IC_11

you should also set your NLS like this

     c:DBD-Oracle set NLS_LANG=.WE8ISO8859P15

Once the above setting are done do a

     c:DBD-Oracle perl Makefile.PL

and then a

     c:DBD-Oracle nmake install

Which will produce a whole of warnings (these you can ignore, as they do not seem to effect DBD::Oracle at all) and near the end it should output something like this;

     Generating code
     Finished generating code
     if exist blibarchautoDBDOracleOracle.dll.manifest mt -nologo -manifest blibarchautoDBDOracleOracle.dll.manifest -outputresource:blibarchauto
DBDOracleOracle.dll;2
     if exist blibarchautoDBDOracleOracle.dll.manifest del blibarchautoDBDOracleOracle.dll.manifest
     C:Perl64binperl.exe -MExtUtils::Command -e "chmod" -- 755 blibarchautoDBDOracleOracle.dll
     C:Perl64binperl.exe -MExtUtils::Command -e "cp" -- Oracle.bs blibarchautoDBDOracleOracle.bs
     C:Perl64binperl.exe -MExtUtils::Command -e "chmod" -- 644 blibarchautoDBDOracleOracle.bs
     C:Perl64binperl.exe "-Iblibarch" "-Ibliblib" ora_explain.PL ora_explain
Extracted ora_explain from ora_explain.PL with variable substitutions.
     C:Perl64binperl.exe -MExtUtils::Command -e "cp" -- ora_explain blibscriptora_explain
        pl2bat.bat blibscriptora_explain

At this point you are all done.

Well almost.

It is important that you test your code before you install but you will have to set a few things up first to get it to fully test correctly.

You will need a TNSNAMES.ORA file that points to a valid DB in the Instant Client Directory

Next you will need to set the ORACLE_USER_ID to a valid user

     c:DBD-Oracle set ORACLE_USER_ID=system/system@XE

You will have to set up TNS_ADMIN to point to the Instant Client Directory

     c:DBD-Oracle set TNS_ADMIN=c:IC_11

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.

Error later on after the compile when you try to use DBD::Oracle.

What is actually going on is that Perl cannot find oci.dll (or one of the other .dlls it needs to run) the

C:/Perl/lib/auto/DBD/Oracle/Oracle.dll’ and the DynaLoader error

is just a false trail as perl is very limited in what it Windows errors it can report on. For more complet info on this sort of error check out this page;

Oracle Troubleshooter HOWTO

by Alexander Foken. It is rather dated but the facts of why perl did not find a dll are still valid.

now you can do this

     c:DBD-Oracle nmake test

and all the tests should run and it will report.

Finally simply do a

     c:DBD-Oracle nmake install

and you are all set.

That is about it.

At this point you might want to add the Instant Client directory permanently to your path so you will not run into the Dynaloader error again.

As well you do not need to keep Visual Studio around to use DBD::Oracle so you can uninstall that as well.

7 Responses to “DBD::Oracle and Windows 64bit”

  • Barry Hulett says:

    John,

    I’ve been banging my head against the wall trying to install DBD-Oracle for the last 3 days. Thanks to the information you provided here, I’ve finally got it installed. You’re efforts are truly appreciated. Thanks a million times!

    Barry

  • Jason says:

    In my case I do have the instant client in my path and I still get the dreaded Can’t load ‘C:/Perl/lib/auto/DBD/Oracle/Oracle.dll’ for module DBD::Oracle: load_file:%1 is not a valid. If sqlplus works the path must be correct b/c the dll’s are in the same folder as sqlplus.

  • Jason says:

    I uninstalled the 64bit Oracle instant client and installed the 32 bit version and the dreaded dll load error went away.

  • Ignacio Ortega says:

    I got it !

    I downloaded 32 bits client such as mentioned before …

    Little differences … I put the ORACLE_SID after perl Makefile.PL and use dmake install instead nmake install and dmake test instead nmake test

    I use perl 5.12, Windows 7 64 bits

    Regards …

  • Tonio says:

    I am on win 7 x64, i have a problem with this test
    failed 31lobt ==>
    Dubious, test returned 1

    And so always same error on web page.

    “install_driver(Oracle) failed: Can’t load ‘C:/Perl64/site/lib/auto/DBD/Oracle/Oracle.dll’ for module DBD::Oracle: load_file:%1 n?est pas une application Win32 valide at C:/Perl64/lib/DynaLoader.pm line 191. at (eval 19) line 3 Compilation failed in require at (eval 19) line 3. Perhaps a required shared library or dll isn’t installed where expected at C:\Inetpub\Scripts\oracletool\oracletool.pl line 19072 “.

  • Davidh says:

    I installed BugZilla 4.4.4 on Windows 7 32bit with Strawberry Perl 5.1.8 , on Oracle 11.2.0.3 32bit too. I ran “checksetup.pl sucessfully and BugZilla tables are created in the Oracle database. So I know DBD::Oracle is working.
    It failed when I tried to run perl.exe index.cgi from D:\bugzilla directory.
    Here is my error, Any pointers would be greatly appreciated
    D:\BugZilla>perl.exe -T index.cgi
    ‘oracle’ is not a valid choice for $db_driver in localconfig: Can’t load ‘lib/MSWin32-x86-multi-thread-64int/auto/DBD/O
    racle/Oracle.dll’ for module DBD::Oracle: load_file:The specified module could not be found at D:/perl32/perl/lib/DynaLo
    ader.pm line 190.
    at Bugzilla/DB/Oracle.pm line 26.
    Compilation failed in require at Bugzilla/DB/Oracle.pm line 26.
    BEGIN failed–compilation aborted at Bugzilla/DB/Oracle.pm line 26.
    Compilation failed in require at (eval 109) line 2.

  • Davidh says:

    Someone from BugZilla support pointed out that I should take out “Tainted” modem from index.cgi. Perl.exe index.cgi is working with “-T”.
    So Obviously there is a different Path that Tainted Mode picked. I am not Perl Expert by any imagination, Is it safe to remove all the tainted mode from all the *.cgi in BugZilla 4.4.4?
    Thank you in advance for any pointer you may have. I also realized I am posting about 32bit, Sorry…

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>