Log in |
Compiling ZOracleDA for Oracle 8.0.5HOW-TO Compile and Install ZoracleDA under Oracle 8.0.5* and Red Hat 6.2
Created By isalsberg. * For Oracle 8.1.7 see the quote at the bottom. This guide
is intended for people who need to use Zope together with Oracle Server. It
gives You a step by step guide from downloading the ZOracleDA to Creating the
connection to the Oracle Server. I decided
to write it after a 3 days set up process, because a lack of information. I
rather prefer to install �stable� versions to avoid problems during production,
nevertheless this time the solution has arrived from a beta version. By the way
I want to give special Thanks to my Friend Pedro Vega <pvega@c...> from the Egroups who helped me
during this painful journey. The
software versions I used during this installation are:
Notes: a
I
said Oracle�s Released Version because the Pre-Released version does not
come with the header (.h) and library files needed to compile the Database
Adapter. b
For
linux You will only find the Oracle
Server Distribution (Oracle�s web site only has a client for WinNT). c
The
compatibility RPM�s mentioned in README file to apply Oracle�s glibpatch come
under the RPM directory on the Red Hat Linux 6.2 distribution CD. It is
necessary to install them: �
compat-binutils-5.2-2.9.1.0.23.1.i386.rpm �
compat-egcs-5.2-1.0.3a.1.i386.rpm �
compat-egcs-c++-5.2-1.0.3a.1.i386.rpm �
compat-glibc-5.2-2.0.7.1.i386.rpm �
compat-libs-5.2-1.i386.rpm d
It
is very important to use the DCOracle beta version 1.3.1b because is the only one
who has adequate Setup files to compile oci_.c under Oracle 8.0.5 or newer. Lets get
started. 1.
If You
are planning to install Oracle using orainst�s
graphical version, You may need to
issue (as root) the command: � #
xhost +locahost � otherwise the installer may not start. The
character version works straightforward. 2.
In
order to make the DA work, first of all You need to apply the glibpatch to
Oracle. Without this patch this Oracle 8.0.5 version core dumps when uses
�shared� libraries (.so) and the ZoracleDA needs those Oracles�s shared
libraries. Applying this patch is really easy just following the README file
that comes with it. 3.
To
compile any Database Adapter it is necessary the Python 1.5.2 Sources. You can
download it from http://www.python.org/ftp/python/src/py152.tgz. a.
Untar
py152.tgz; lets say under /mypython. , It will generate the directory
/mypython/Python-1.5.2. b.
Go to
/mypython/Python-1.5.2 and run configure and afterwards make:
i.
#
./configure
ii.
#
./make c.
Generate
the config directory and copy the following files:
i.
#
mkdir /usr/lib/python1.5/config
ii.
# cp
/mypython/Python-1.5.2/Makefile /usr/lib/python1.5/config
iii.
# cp
/mypython/Python-1.5.2/Modules/Setup /usr/lib/python1.5/config
iv.
# cp
/mypython/Python-1.5.2/Modules/config.c* /usr/lib/python1.5/config
v.
# cp
/mypython/Python-1.5.2/Modules/makesetup /usr/lib/python1.5/config
vi.
# cp
/mypython/Python-1.5.2/config.h /mypython/Python-1.5.2/Include 4.
Now, untar
the DCOracle-1.3.1b1-nonbin.gz file on temporary area, by instance /tmp. Go to /tmp/DCOracle-1.3.1b1/src subdirectory
and do these steps: a.
# cp
Setup-8.0.5-linux-intel Setup b.
# cp
Makefile.pre.in-1.5 Makefile.pre.in c.
# make
-f Makefile.pre.in boot d.
vi the
Setup file, so it looks like this one. (Remember that �mypython� is the
directory where You untar the python sources): *shared* # Setup file for Oracle 8.0.5, shared library
build on Linux # # Unfortunately, the libraries needed to link
Oracle change from revision # to revision. # # Caveat Emptor (MTK) ORACLE_INCLUDES=$(ORACLE_HOME)/rdbms/demo -I$(ORACLE_HOME)/plsql/public \ -I$(ORACLE_HOME)/network/public -I/mypython/Python-1.5.2/Include ORACLE_L=-lclntsh -lcommon -lcore4 -lnlsrtl3 ORACLE_LIBS=$(ORACLE_HOME)/lib/ $(ORACLE_L) oci_ oci_.c -I$(ORACLE_INCLUDES)
-L$(ORACLE_LIBS) -DDCORACLE8 Buffer -I/mypython/Python-1.5.2/Include
Buffer.c ~ 5.
Define
all the environment variables needed to access the Oracle instance. Remember to write YOUR :actual values
for the Oracle�s HOME and SID: a.
#
export ORACLE_HOME=/home/oracle/product/8.0.5 b.
#
export ORACLE_SID=oracle c.
#
export LD_LIBRARY_PATH=$ORACLE_HOME/lib d.
#
export PATH=$PATH:$ORACLE_HOME/bin 6.
Now we
can build the extensions used by DCOracle. Don�t worry if when compiling sends
some warnings.: a.
# make 7.
Verify
that the previous step generated the following files: -rwxrwxr-x 1 isaac isaac 39658 Aug 9 18:48
Buffer.so -rwxrwxr-x 1 isaac isaac 276567 Aug 9 18:48
oci_.so 8.
Testing
the extensions using the script DCOracle_test.py. To execute the test You
should know a valid Oracle user and password.(scott and tiger
respectively). Remember that for remote connections the name
that follow �at� must exist in the tnsnames.ora file. Just to be shure that the Oracle user exist you
can try with: a.
#
sqlplus scott/tiger@oracle (If listener
is enabled) OR # sqlplus scott/tiger (If listener is not running) Choose the sqlplus command that worked (lets say the first one) and test
the extensions: b.
#
python DCOracle_test.py scott/tiger@oracle If everything goes well You shuold see: Import succeeded Connect succeeded If the test core dumps, means Oracle�s glibpatch has not been installed. Try reinstalling the patch and recompile the extension modules erasing first all the �*o� files. 9. Now install the ZOracleDA product. To do so: a. Untar the ZOracleDA-2.2.0b1-src.tgz under the Zope�s HOME directory. This will generate DCOracle under <Zope_HOME>/lib/python/Products/ZOracleDA. b. Go to <Zope_HOME>/lib/python/Products/ZOracleDA/DCOracle directory and copy the extension files: i. # cp /tmp/DCOracle-1.3.1b1/src/*.so . ii. # chmod 755 *.so 10. vi the <Zope_HOME>/start file adding at the begining of the file, the environment variables needed to connect to Oracle. Do not forget to type current values corresponding to YOUR Oracle installation: #!/bin/sh export ORACLE_HOME=/home/oracle/product/8.0.5 export ORACLE_SID=oracle export LD_LIBRARY_PATH=$ORACLE_HOME/lib reldir=`dirname $0` ... 11. Restart Zope. You can add now the ZOracle Connection. Finally, for those who are
using Oracle 8.1.7, Stefano Vedovelli kindly quoted: �In the
8.1.7 release, some includes are no longer under
the ORA_HOME/rdmbs/demo but also under the ORA_HOME/rdbms/public. This will
create tons of problems to an not-used user. Therefore, somebody must edit the Setup file and append at the end of the line ORACLE_INCLUDES.......... the string -l$(ORACLE_HOME)/rdbms/public This way it works.� That�s it. I hope this will help. |