Compiling DBD::Oracle for Red Hat Linux with the Oracle Instant Client
From my work intrablog, Tuesday, April 29th, 2008. I tested today and the same patch is necessary.
It’s annoying how much harder this is than the MySQL driver…
- Download these RPMs from Oracle’s Instant Client for Linux page:Instant Client Package – Basic: All files required to run OCI, OCCI, and JDBC-OCI applications Instant Client Package – SDK: Additional header files and an example makefile for developing Oracle applications with Instant Client [just for future fun] Instant Client Package – ODBC: Additional libraries for enabling ODBC applications
- Installify them,
$ sudo rpm -ivh oracle-instantclient-*.rpm
- Get DBD::Oracle
sudo cpan
cpan> look DBD::Oracle
- Look at README.linux.txt
- Set up the environment
export ORACLE_HOME=/usr/lib/oracle/11.1.0.1/client/lib export LD_LIBRARY_PATH=$ORACLE_HOME export LIBPATH=$ORACLE_HOME export ORACLE_DSN="DBI:Oracle:host=myhost;sid=MYINSTANCE" # remember to quote the ; export ORACLE_USERID=myusername/mypassword
- I had to patch the Makefile.PL (sent changes to the maintainer) to find the header files with a longer “client_version_full”:
# diff -u Makefile.PL Makefile.PL.dist --- Makefile.PL 2008-07-31 10:53:00.253634000 -0800 +++ Makefile.PL.dist 2008-07-31 10:51:49.327631000 -0800 @@ -1538,7 +1538,7 @@ if (!$client_version_full) { print "I'm having trouble finding your Oracle version number... trying harder\n" unless $force_version; - if ( $OH =~ m\.\d+\.\d+<strong>(\.\d+)?</strong>)! ) { #decode it from $OH if possible + if ( $OH =~ m\.\d+\.\d+)! ) { #decode it from $OH if possible $client_version_full = $1; } elsif ( "$OH/" =~ m!\D(8|9|10)(\d)(\d?)\D!) { # scary but handy
- Install normally:
perl Makefile.PL make make test # a few minor failures make install