Configure Perl DBI and DBD in Linux

11,468

That's a pretty old version of Perl (released Jan 2006). I did manage to get to work for similar versions of each component but it never passed the build tests. Besides your LD_LIBRARY_PATH (some systems use a 64-bit version) and ORACLE_HOME, I had to be careful with default character set and locale to get this to work. Be careful too of having multiple homes. In the end, I installed Oracle's Instant Client separately and defined the real instance through tnsnames.

Redoing this later with newer software was much easier on a very similar system. So, upgrade if possible or use an Instant Client for a simpler environment.

Share:
11,468

Related videos on Youtube

Balualways
Author by

Balualways

Updated on September 18, 2022

Comments

  • Balualways
    Balualways over 1 year

    I am new to Perl and I work in a Linux OEL 5x server. I am trying to configure the Perl DB modules for Oracle connectivity (DBD and DBI modules). Can anyone help me out in the installation procedure?

    I had tried CPAN didn't really worked out. Any help would be appreciated. I am not quite sure I need to initialize any variables other than $LD_LIBRARY_PATH and $ORACLE_HOME

    These are my observations:

    ISSUE:: I am getting the following issue while using the DBI module to connect to Oracle:

    install_driver(Oracle) failed: Can't locate loadable object for module DBD::Oracle in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at (eval 3) line 3
    Compilation failed in require at (eval 3) line 3.
    Perhaps a module that DBD::Oracle requires hasn't been fully installed
    at connectdb.pl line 57
    

    I had installed the DBD for oracle from /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DBD/DBD-Oracle-1.50

    Could you please take a look into the steps and correct me if I am wrong:

    Observations:

    $ echo $LD_LIBRARY_PATH
    /opt/CA/UnicenterAutoSysJM/autosys/lib:/opt/CA/SharedComponents/Csam/SockAdapter/lib:/opt/CA/SharedComponents/ETPKI/lib:/opt/CA/CAlib
    $ echo $ORACLE_HOME
    /usr/local/oracle/ORA
    

    This is how I tried to install the DBD module:

    1. Download the file DBD 1.50 for Oracle
    2. Copy to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DBD
    3. Untar and Makefile.PL

    .

    Message:  Using DBI 1.52 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/
    
    Configuring DBD::Oracle for perl 5.008008 on linux (x86_64-linux-thread-multi)
    
    Remember to actually *READ* the README file! Especially if you have any problems.
    
    Installing on a linux, Ver#2.6
    Using Oracle in /opt/oracle/product/10.2
    DEFINE _SQLPLUS_RELEASE = "1002000400" (CHAR)
    Oracle version 10.2.0.4 (10.2)
    Found /opt/oracle/product/10.2/rdbms/demo/demo_rdbms.mk
    Found /opt/oracle/product/10.2/rdbms/demo/demo_rdbms64.mk
    Found /opt/oracle/product/10.2/rdbms/lib/ins_rdbms.mk
    Using /opt/oracle/product/10.2/rdbms/demo/demo_rdbms.mk
    Your LD_LIBRARY_PATH env var is set to '/usr/local/oracle/ORA/lib:/usr/dt/lib:/usr/openwin/lib:/usr/local/oracle/ORA/ows/cartx/wodbc/1.0/util/lib:/usr/local/oracle/ORA/lib:/usr/local/sybase/OCS-12_0/lib:/usr/local/sybase/lib:/home/oracle/jdbc/jdbcoci73/lib:./'
    WARNING: Your LD_LIBRARY_PATH env var doesn't include '/opt/oracle/product/10.2/lib' but probably needs to.
    Reading /opt/oracle/product/10.2/rdbms/demo/demo_rdbms.mk
    Reading /usr/local/oracle/ORA/rdbms/lib/env_rdbms.mk
    
    Attempting to discover Oracle OCI build rules
    sh: make: command not found
    by executing: [make -f /opt/oracle/product/10.2/rdbms/demo/demo_rdbms.mk build ECHODO=echo ECHO=echo GENCLNTSH='echo genclntsh' CC=true OPTIMIZE= CCFLAGS= EXE=DBD_ORA_EXE OBJS=DBD_ORA_OBJ.o]
    WARNING: Oracle build rule discovery failed (32512)
    Add path to make command into your PATH environment variable.
    Oracle oci build prolog:
        [sh: make: command not found]
    Oracle oci build command:
        []
    WARNING: Unable to interpret Oracle build commands from /opt/oracle/product/10.2/rdbms/demo/demo_rdbms.mk.
    (Will continue by using fallback approach.)
    Please report this to [email protected]. See README for what to include.
    
    Found header files in /opt/oracle/product/10.2/rdbms/public.
    
    client_version=10.2
    
    
    DEFINE= -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"10.2.0.4\" -DORA_OCI_102
    
    
    Checking for functioning wait.ph
    
    
    System: perl5.008008 linux ca-build9.us.oracle.com 2.6.20-1.3002.fc6xen #1 smp thu apr 30 18:08:39 pdt 2009 x86_64 x86_64 x86_64 gnulinux
    Compiler:   gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm
    Linker:     not found
    Sysliblist: -ldl -lm -lpthread -lnsl -lirc
    Oracle makefiles would have used these definitions but we override them:
      CC:       cc
      CFLAGS:   $(GFLAG) $(OPTIMIZE) $(CDEBUG) $(CCFLAGS) $(PFLAGS)\
        $(SHARED_CFLAG) $(USRFLAGS)
           [$(GFLAG) -O3 $(CDEBUG) -m32 $(TRIGRAPHS_CCFLAGS) -fPIC -I/usr/local/oracle/ORA/rdbms/demo -I/usr/local/oracle/ORA/rdbms/public -I/usr/local/oracle/ORA/plsql/public -I/usr/local/oracle/ORA/network/public -DLINUX -D_GNU_SOURCE -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -fno-strict-aliasing $(LPFLAGS) $(USRFLAGS)]
      build:     $(CC) $(ORALIBPATH) -o $(EXE) $(OBJS) $(OCISHAREDLIBS)
           [ cc -L$(LIBHOME) -L/usr/local/oracle/ORA/rdbms/lib/ -o $(EXE) $(OBJS) -lclntsh     $(EXPDLIBS) $(EXOSLIBS) -ldl -lm -lpthread -lnsl -lirc -ldl -lm $(USRLIBS) -lpthread]
      LDFLAGS:  $(LDFLAGS32)
           [-m32 -o $@ -L/usr/local/oracle/ORA/rdbms//lib32/ -L/usr/local/oracle/ORA/lib32/ -L/usr/local/oracle/ORA/lib32/stubs/]
    Linking with /usr/local/oracle/ORA/rdbms/lib/defopt.o  -lclntsh -ldl -lm -lpthread -lnsl -lirc -ldl -lm -lpthread [from $(DEF_OPT) $(OCISHAREDLIBS)]
    
    Checking if your kit is complete...
    Looks good
    LD_RUN_PATH=/usr/local/oracle/ORA/lib
    Using DBD::Oracle 1.50.
    Using DBD::Oracle 1.50.
    Using DBI 1.52 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/
    Writing Makefile for DBD::Oracle
    Writing MYMETA.yml and MYMETA.json
    
    ***  If you have problems...
         read all the log printed above, and the README and README.help.txt files.
         (Of course, you have read README by now anyway, haven't you?)
    
    • Joshua Hoblitt
      Joshua Hoblitt over 11 years
      > sh: make: command not found Your build environment appears to be broken.
    • Greg Petersen
      Greg Petersen over 11 years
      rpm -q make??
    • charlesbridge
      charlesbridge over 11 years
      They should be available in a repository rpm -ivh perl-DBD-oracle and possilby rpm -ivh perl-DBI if it also fails to build
  • masegaloeh
    masegaloeh over 9 years
    Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Link-only answers can become invalid if the linked page changes.