Dbd::Oracle Installation Causing Error

Error while installing DBD::Oracle

After the installation and setup of the Oracle Instant Client, use the normal build steps without the cpan tool, and pass the -l option to the Makefile.PL

  1. Download the tar.gz package and unpack it

  2. Build it

    perl Makefile.PL -l
    make && make test
  3. Install

    make install

Perl DBD::Oracle Module installation

  • Install if missing ExtUtils-MakeMaker module (sudo yum install perl-ExtUtils-MakeMaker)
  • Install Perl DBI module ($ yum install perl-DBI)
  • Manually install below three RPMs for Oracle instant client (from Instant Client Downloads for Linux x86-64. The example is for v11.2.0.3.0-1: adapt the commands below to the actual version.)

    oracle-instantclient11.2-basic-11.2.0.3.0-1
    oracle-instantclient11.2-devel-11.2.0.3.0-1
    oracle-instantclient11.2-sqlplus-11.2.0.3.0-1

I am using 64 bit Linux box, so select your RPM filenames accordingly. Something like sudo yum -y install oracle-instantclient*rpm should do)

  • set below variables:

    export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
    export ORACLE_HOME=/usr/lib/oracle/11.2/client64

    MacOS users will need:

    DYLD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/

    Also add ORACLE_HOME to your PATH variable.

  • download DBD::Oracle from CPAN

  • untar the module and run below commands in given sequence:

    perl Makefile.PL
    make
    sudo make install

In case you get complaints about missing gcc you can (temporarily) install it and then remove it.

DONE !!!

Issues I had faced were due to the wrong LD_LIBRARY_PATH. I had set it to /usr/lib/oracle/11.2/client64 whereas the correct value is /usr/lib/oracle/11.2/client64/lib.

Certainly, this was a great learning for a newbie like me.

Regarding Perl DBD::Oracle installation in local directory

If DBI is already installed, you should only need to install DBD::Oracle, though you might want to install a later version of DBI. You can install DBD::Oracle under your home directory, then set the PERL5LIB environment variable to that directory (or to include that directory). The long way to install is:

perl Makefile.PL PREFIX=~/perl #Or whatever sub-directory you like
make
make test
make install

Then include at least "~/perl/lib;~/perl/lib/site_perl" in PERL5LIB before running your programs (or include a 'use lib" in your programs).

You can also set certain environment variables like PERL_MM_OPT and PERL_MB_OPT so that you don't have to specify the PREFIX= on the command line (see docs for ExtUtils::MakeMaker and Module::Build). I also recommend cpanm and setting PERL_CPANM_HOME to something under your home directory.

DBD::Oracle fails to connect with OCIEnvInit when called when accessed through webserver only

Are you sure that ORACLE_HOME and other relevant environment variables (e.g., LD_LIBRARY_PATH) that are set in your shell when you run the script from the command line are also set to the same values in the apache/PHP process?

DBD::Oracle: load_file:The specified module could not be found

Apparently, a reboot was needed. After the reboot, connections through Perl were possible. This is here in case someone is as stupid as me. I'm going back my AS/400 now...



Related Topics



Leave a reply



Submit