This was a major pain. Not only is DBD::Oracle a PITA to install in general, doing it on Solaris 10 will cause you to rage uncontrollably. In this post we'll install the module manually as there can be numerous instances when you don't have the Sun/Oracle Studio compiler (Solaris 10 ships with gcc by default) or don't have access to Perl's CPAN (firewall rules blocking internet access on a corporate server, etc).

First of, install the Oracle InstantClient. This is needed for the module to work with Oracle. This client will give you enough functionality without the need to install the Oracle database server. You will need 3 packages available from Oracle:
[code]basic-11.2.0.2.0-solaris-x32.zip
sqlplus-11.2.0.2.0-solaris-x32.zip
sdk-11.2.0.2.0-solaris-x32.zip[/code]

The sdk-11.2.0.2.0-solaris-x32.zip package is particularly important because it'll have numerous libraries that we will need for building the module.

Unzip them and move the instantclient_11_2 directory to /opt on your filesystem. All the SQL+ and SDK stuff will be in the instantclient_11_2 directory after unzipping.
[code]sudo mv ~/instantclient_11_2 /opt/instantclient_11_2[/code]
Set your $ORACLE_HOME and $LD_LIBRARY_PATH environmental variables:
[code]
export ORACLE_HOME=/opt/instantclient_11_2
export LD_LIBRARY_PATH=/opt/instantclient_11_2
[/code]
You can verify that these are set correctly by running env which will spit out all the variables for your shell environment:
[code]env[/code]
Download and untar DBD::Oracle Perl module from here.
gzip DBD-Oracle-1.38.tar.gz | tar -xvf -
cd DBD-Oracle-1.38[/code]
Once we're in the directory, we'll start building the module from source. For this we'll use perlgcc.
[code]sudo /usr/perl5/bin/perlgcc Makefile.PL
/usr/sfw/bin/gmake
/usr/sfw/bin/gmake install[/code]

The reason why we are using perlgcc is because Perl on Solaris 10 was built using Sun Studio and we don't have that available on the system. Building the modules with gcc will also help us avoid any issues that we might encounter with building using Sun Studio. You can read more about this here.

This should successfully install the DBD::Oracle module on your system. Remember to set your $ORACLE_HOME AND $LD_LIBRARY_PATH whenever you use it in your Perl scripts. You may need to put it in .bash_profile to load each time you log into the system.


Comments

comments powered by Disqus