DBD::Oracle perl module installation on CentOS 5

Filed under: Linux,perl — nax @ 22:19

I tell you, to install DBD::Oracle isn’t an easy job, especially if some college already tried on a same box. That was exactly situation I faced lately on one box. I needed that DBI driver really badly because I needed to migrate set of scripts to manipulate our data from purly storage server to dedicated Linux box. Not a big deal – script are written in perl, so no problem with different platform – except dam Oracle perl module!

OK, I tried to find some rpm with that module, but was out of luck.

Never mind, with Perl there is always CPAN repository.

# perl -MCPAN -e shell
cpan> install DBD::Oracle

This will probably fail, because you need first to have setup a few environemt variable. The most obvious is ORACLE_HOME which point to the directory with libraries. Unfortunately even if I had correct lib there, the build failed with following LD error:

/usr/bin/ld: skipping incompatible /usr/lib/oracle/ when searching for -lclntsh
/usr/bin/ld: cannot find -lclntsh
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/DBD/Oracle/Oracle.so] Error 1
/usr/bin/make — NOT OK

The reason for this error is wrong platform of installed Oracle libraries, as described in this thread

You can find out platform easily:
uname -a
Linux hostname 2.6.18-128.1.10.el5xen #1 SMP Thu May 7 11:07:18 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

Mine libraries was supposed for 32bit which usually works with 64bit system – but not in this case.

Next error was also a bit confusing:

t/10general.t ……….. Can’t connect to data source ‘MYDB’ because I can’t work out what driver to use (it doesn’t seem to contain a ‘dbi:driver:’ prefix and the DBI_DRIVER env var is not set) at t/10general.t line 22

Strange, but I had to do this:

export DBI_DRIVER="Oracle"

It is also a good idea to read carefully a README file. It helps you avoid other errors during the tests. I came across an error that I do not have alter table privilege. Unfortunately the only workaround I found is just delete the test (t subfolder in you .cpan cache).

Next challenge is to do installation of sqlldr utility.

Comments are closed.

Powered by WordPress