Oracle Database connector module for Python
I came across several (CodingNaked WebSite & Pedro Emanuel de Castro Faria Blog ) howTo's on the internet explaining how to compile and install previous versions of this connector. I decided to write my own howTo describing the latest version of the module (as of writing cx_Oracle 5.0).
(I am assuming you have the Xcode developers tools already installed since you will need the GCC compiler)
You need the follwing software:
Oracle Instant Client
cx_Oracle Module 5.0
Download the following packages from the Oracle Instant client site:
Instant Client Package - Basic
Instant Client Package - SQL*Plus
Instant Client Package - SDK
Extact all of these, then place their contents into a single directory
In my case I created a director called /opt/oracle/instantclient_10_2, and place all of the contents from all three archives in this directory.
Then run the following commands (assuming you created the same directory)
Now you need to edit you profile:
Copy and paste the below (Please note the paths and adjust accordingly)
now run the following commands (you need to do this or the build will fail).
I extracted the cx_Oracle module to /opt/oracle/cx_Oracle-5.0. All you have to do now is run these commands at the module will be built and installed.
3 Comments
Hide/Show Comments19 Feb, 2009
Anonymous
Kashif:
I followed your example except I received an error while building. Perhaps you've experienced the same thing, and can give me a clue as to what I'm doing wrong.
Traceback (most recent call last):
File "setup.py", line 123, in <module>
raise DistutilsSetupError("cannot locate an Oracle software " \
distutils.errors.DistutilsSetupError: cannot locate an Oracle software installation
It isn't finding the oracle files it needs. Do I need more than the three you listed to download?
My structure is like this:
/Users/mathieu/src/oracle/cx_Oracle-5.0.1
/Users/mathieu/src/oracle/instantclient_10_2
instantclient has the contents of the three downloads from Oracle.
any ideas?
Mathieu
mathieusteele (at) gmail.com
10 Dec, 2009
Anonymous
Hi Mathieu,
I was wondering if you changed the variable for oracle :
ORACLE_HOME="/opt/oracle"
export ORACLE_HOME
DYLD_LIBRARY_PATH="$ORACLE_HOME/instantclient_10_2"
export DYLD_LIBRARY_PATH
SQLPATH="$ORACLE_HOME/instantclient_10_2"
export SQLPATH
export PATH="$PATH:$ORACLE_HOME/instantclient_10_2"
to the correct paths you gave?
/Users/mathieu/src/oracle/cx_Oracle-5.0.1
/Users/mathieu/src/oracle/instantclient_10_2
23 Apr, 2011
Anonymous
thanks... finally someone took the time to write this down correctly.
Add Comment