ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can't load '/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: /home/oracle/oracle/product/10.2.0/db_2/lib/libnnz10.so: cannot restore segment prot after reloc: Permission denied at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230.
at -e line 1
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
But while installing DBD:Oracle from source, it installed successfully without any error.
Not sure what that error message means, and haven't searched the 'net for it. (Have you?)
I'm using Perl to extract rows from Oracle (via SELECT) statements, and I also utilize the DBI and DBD::Oracle modules.
A few questions:
Have you set up your Oracle environment for the user who is attempting to run that command? For Bourne shell, that includes exporting ORACLE_HOME, ORACLE_SID, ORACLE_BASE, and possibly PATH and LD_LIBRARY_PATH.
How did you install DBD::Oracle, exactly? (Not sure what you specifically mean by "from source".)
For posterity's sake, here's a quick example (YMMV) of a file that can be sourced into a Bourne shell environment:
And here's a Perl script that SELECTs rows from a table, after inheriting the above environment:
Code:
#!/usr/bin/perl
use warnings ;
use strict ;
use DBI ;
# Make connection to Oracle
#
my $oh = DBI->connect( 'dbi:Oracle:BigDB',
'sneaky',
'***' )
or die "DB error: $DBI::errstr" ;
# Build and execute query
#
my $query = qq! SELECT * FROM GOOD_FUN_TABLE ! ;
my $pquery = $oh->prepare($query) ;
$pquery->execute ;
while (my @row = $pquery->fetchrow_array) {
# Perl gets angry about NULL values, so we get
# a little help from the neat_list function.
#
print DBI::neat_list(\@row) . "\n" ;
}
# Close prepared query handle
#
$pquery->finish ;
$oh->disconnect ;
I need to do an LQ wiki topic on Perl + Oracle one of these days. It's a pain in the %#$ to set up, sadly. (Much easier with Python and cx_Oracle. But I like Perl better. I digress.)
All the environment are set in ~.bashrc file of user oracle.
Initially I tried to install through cpan and result is as below:
Code:
install DBD:Oracle
Running install for module 'DBD::Oracle'
Running make for P/PY/PYTHIAN/DBD-Oracle-1.44.tar.gz
Has already been unwrapped into directory /root/.cpan/build/DBD-Oracle-1.44-CaTjqL
Has already been made
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/000-report-versions.t ... # Testing with Perl 5.008008, /usr/bin/perl
t/000-report-versions.t ... 1/? # Carp version is 1.04
# Config version is undefined
# DBI version is 1.621
# Data::Dumper version is 2.131
# Devel::Peek version is 1.03
# DynaLoader version is 1.05
# Encode version is 2.12
# Exporter version is 5.58
# ExtUtils::MakeMaker version is 6.62
# Math::BigInt version is 1.77
# Failed test 'use Oraperl;'
# at t/000-report-versions.t line 440.
# Tried to use 'Oraperl'.
# Error: install_driver(Oracle) failed: Can't load '/root/.cpan/build/DBD-Oracle-1.44-CaTjqL/blib/arch/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: /home/oracle/oracle/product/10.2.0/db_2/lib/libnnz10.so: cannot restore segment prot after reloc: Permission denied at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230.
# at (eval 29) line 3
# Compilation failed in require at (eval 29) line 3.
# Perhaps a required shared library or dll isn't installed where expected
# at /root/.cpan/build/DBD-Oracle-1.44-CaTjqL/blib/lib/Oraperl.pm line 55
# Compilation failed in require at (eval 28) line 2.
# BEGIN failed--compilation aborted at (eval 28) line 2.
Bailout called. Further testing stopped: can't load Oraperl
# Tests were run but no plan was declared and done_testing() was not seen.
FAILED--Further testing stopped: can't load Oraperl
make: *** [test_dynamic] Error 255
PYTHIAN/DBD-Oracle-1.44.tar.gz
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports PYTHIAN/DBD-Oracle-1.44.tar.gz
Running make install
make test had returned bad status, won't install without force
Failed during this command:
PYTHIAN/DBD-Oracle-1.44.tar.gz : make_test NO
Then from source I tried as:
Quote:
perl Makefile.PL
make
make install
without error.
I generally use shell scripts in my works.
But since last few weeks ,I am learning perl and I love to use perl in my work whenever possible.
Last edited by divyashree; 05-30-2012 at 02:28 PM.
FWIW - and I hope you're able to determine otherwise - I was not able to get DBD::Oracle working with RHEL5 and Perl v5.8 at all.
So I actually downloaded the latest Perl source code, compiled it and installed it into a "sandboxed" environment (using an unprivileged user), e.g. /myperl. Then, I installed DBI and DBD::Oracle into the shiny, new /myperl environment.
In order to do all that successfully, I first had to set:
Create /myperl, and give your user ownership/write permissions to it.
Download, compile, and install Perl into /myperl.
Install DBI and DBD::Oracle using the cpan(1) command (it is included with Perl).
Then, of course, for Perl scripts that will utilize the new environment, set #!/myperl/bin/perl as the interpreter.
If you decide you're crazy enough (like me) to go to all this trouble, do NOT do any of these steps (except for creating the /myperl directory) as root. If you accidentally trample your Perl v5.8 install, you could potentially screw up your system.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.