Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DBD-Oracle and Oracle Instant Client recipe

1 view
Skip to first unread message

Tim Barrass

unread,
Feb 17, 2005, 9:52:03 AM2/17/05
to dbi-...@perl.org
Not sure if this has been solved already, but here's how I built
DBD-Oracle against the Oracle Instant Client ..

Build DBD against Oracle Instant Client SDK

Building on ScientificLinux3, perl 5.8.0 (basically RHE3).

Need OIC version 10.1.0.3. Download the basic, sqlplus and devel zips.
You need to rejiggle the files (not many) to form a reasonable
directory structure. Assume $BASE holds your top level directory for
installation, then:

mkdir $BASE
cd $BASE
# download instantclient-basic-linux32-10.1.0.3.zip
# download instantclient-sqlplus-linux32-10.1.0.3.zip
# download instantclient-sdk-linux32-10.1.0.3.zip
unzip *.zip # creates dir instantclient10_1
export ORACLE_HOME=${BASE}/instantclient10_1
cd $ORACLE_HOME
ln -s libclntsh.so.10.1 libclntsh.so
mkdir lib
mkdir bin
mkdir java
mv lib* lib
mv sqlplus bin
mv glogin.sql bin
mv *jar java
mv sdk/demo .
mv sdk/include .
rm -fr sdk
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export SQLPATH=$ORACLE_HOME/bin
cd ..
mkdir perl-modules
cd perl-modules
wget
http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBD-Oracle-1.16.tar.gz
tar zxvf DBD-Oracle-1.16.tar.gz

# Need to edit the Makefile.PL- here's my diff
diff Makefile.PL.orig Makefile.PL
1122a1123,1126
> # Tim Barrass: hacked for Oracle Instant Client
> if ( $OH =~ /instantclient/ ) {
> $linkvia = "$ENV{ORACLE_HOME}/lib/libclntsh.so";
> }
1254a1259
> "$OH/include", # Tim Barrass, hacked for OIC install from zips

perl Makefile.PL prefix=$BASE/perl-modules -m $ORACLE_HOME/demo/demo.mk

# If you see WARNING: I could not determine Oracle client version ...
# remove the trailing slash from ORACLE_HOME

make
make install

# Create and environment script
export BASE=<your base dir>
export ORACLE_HOME=${BASE}/instantclient10_1
export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}
export PATH=${ORACLE_HOME}/bin:${PATH}
export SQLPATH=${ORACLE_HOME}/bin
# Note the trailing end of perl5lib might vary with architecture-
# look out for where your DBD-Oracle actually gets installed
export
PERL5LIB=${ORACLE_HOME}/perl-modules/lib/perl5/site_perl/5.8.0/i386-
linux-thread-multi
export TNS_ADMIN=<path to your tnsnames.ora file>

# test at will ...

Cheers,
Tim

Tim Barrass

unread,
Feb 17, 2005, 9:58:10 AM2/17/05
to dbi-...@perl.org

On 17 Feb 2005, at 14:52, Tim Barrass wrote:

> # look out for where your DBD-Oracle actually gets installed
> export
> PERL5LIB=${ORACLE_HOME}/perl-modules/lib/perl5/site_perl/5.8.0/i386-
> linux-thread-multi

The eagle-eyed will notice that this should be

# look out for where your DBD-Oracle actually gets installed
export

PERL5LIB=${BASE}/perl-modules/lib/perl5/site_perl/5.8.0/i386-linux-
thread-multi

Sorry :/

Tim

goo...@jbnoel.com

unread,
Mar 15, 2005, 12:17:55 PM3/15/05
to
Tim,

Thanks so much for this post. This is exactly what I've been trying to
get done. Unfortunately, I can't get this to work. When I do :

----------------------------------------------------------------------------
----------------------------------------------------------------------------
perl Makefile.PL prefix=/usr/lib/oracle/perl-modules -m
$ORACLE_HOME/demo/demo.mk
----------------------------------------------------------------------------
----------------------------------------------------------------------------

I get the output below. Do you have any suggestions?

Also, I have no idea what or where the tnsnames.ora file is. I am
simply trying to connect to a remote machine that is running Oracle
from my Linux box. I have successfully installed dbd::oracle on a
Windows machine and have connected to the Oracle server on the remote
machine without speficying anything in this tnsnames.ora file. Is it
necessary on Linux but not windows?

----------------------------------------------------------------------------
----------------------------------------------------------------------------
nettest1:/usr/lib/oracle/perl-modules/DBD-Oracle-1.16 $ perl
Makefile.PL -m $ORACLE_HOME/demo/demo.mk
Multiple copies of Driver.xst found in:
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/DBI at
Makefile.PL line 39
Using DBI 1.43 (for perl 5.008 on i386-linux-thread-multi) installed in
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI

Configuring DBD::Oracle ...

>>> Remember to actually *READ* the README file!
Especially if you have any problems.

Using Oracle in /usr/lib/oracle/instantclient10_1
DEFINE _SQLPLUS_RELEASE = "1001000300" (CHAR)
Oracle version 10.1.0.3 (10.1)
Found /usr/lib/oracle/instantclient10_1/demo/demo.mk
Using /usr/lib/oracle/instantclient10_1/demo/demo.mk
Reading /usr/lib/oracle/instantclient10_1/demo/demo.mk
ERROR parsing /usr/lib/oracle/instantclient10_1/demo/demo.mk: Unable to
determine what to link with.
Please send me copies of these files (one per mail message):
/usr/lib/oracle/instantclient10_1/demo/demo.mk
----------------------------------------------------------------------------
----------------------------------------------------------------------------

Thanks,
Justin

0 new messages