Hello monks,

I've been struggling for about a week with getting perl to work with Oracle database.

Finally I was able to get both the DBI and Oracle DBD CPAN modules I had downloaded installed successfully when I dug through the links someone posted on perlmonks regarding compiling cpan modules under Solaris.

This advice was the most useful:

Building CPAN modules on Solaris might be a bit different than on your + average Linux platform. Here is the reason why: Solaris 10 comes pre-installed with Perl 5.8.4. This is the good news. + However, it has been built with Sun's Studio compiler suite. When pe +rl is built it saves the name of the compiler and any compiler flags +in its configuration files, and then uses these saved settings when a +ny additional modules are built. So when you try to build additional +modules it will expect to find the Sun Studio compiler. Solaris 10 comes pre-installed with GNU C/C++ compiler but the Sun Stu +dio compiler is optional and is likely not installed. Luckily Solaris comes with a tool called perlgcc that fixes this probl +em. It will make sure that modules are build with gcc rather than the + Sun Studio compiler. Instead of invoking perl Makefile.PL to generat +e the makefile needed to compile a module, perlgcc Makefile.PL should + be used instead. All command-line arguments to perlgcc are passed un +modified to perl. Needless to say you can forget all in this article if you have Sun Stu +dio compiler installed and wish to use that for building modules. How +ever most Perl modules have only been tested to compile with the GNU +C/C++ compiler so if you do not want trouble stick with the recipe in + this article.


I was able to find this useful info here:
Building CPAN Perl modules on Solaris 10 (and 11)

It turned out that I needed a command called perlgcc to compile the CPAN module and not the perl command.

So, instead of
perl Makefile.PL
I needed to use
perlgcc Makefile.PL
Instead. Once I did that everything went smoothly and installed no problem.

However, when I run my dbi test script I am seeing an error:
[db07-dc2:~] root% ./dbitest.pl ld.so.1: perl: fatal: relocation error: file /usr/perl5/site_perl/5.8. +4/sun4-solaris-64int/auto/DBD/Oracle/Oracle.so: symbol OCINlsEnvironm +entVariableGet: referenced symbol not found Killed


This is the script I am trying to run
#!/usr/bin/perl use warnings; use strict; use DBI; my $ORACLE_HOME = "/u01/app/oracle/product/10.2.0.4"; my $ORACLE_SID="qaecom2"; my $USER="user"; my $PASS="password"; $ENV{ORACLE_HOME}=$ORACLE_HOME; $ENV{ORACLE_SID}=$ORACLE_SID; $ENV{PATH}="$ORACLE_HOME/bin"; $ENV{LD_LIBRARY_PATH}="$ORACLE_HOME/lib"; use strict; use DBI; my $dbh = DBI->connect( "dbi:Oracle:$ORACLE_SID", "$USER", "$PASS", ) || die "Database connection not made: $DBI::er +rstr"; $dbh->disconnect;
Here's my machine info and perl version

[db07-dc2:~] root% uname -a SunOS db07-dc2 5.10 Generic_147440-09 sun4u sparc SUNW,Sun-Fire-15000


[db07-dc2:~] root% perl -v This is perl, v5.8.4 built for sun4-solaris-64int (with 36 registered patches, see perl -V for more detail)
I was hoping that someone out there might have enough experience with this type of error to suggest a solution. Thanks in advance!


In reply to perl: fatal: relocation error: by bluethundr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.