To install cx_Oracle in Fedora8 (or in most of Linux flavor)
1) Download cx_Oracle form http://cx-oracle.sourceforge.net (latest version is 5.0.4)
2) Download instantclient from Oracle http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
http://www.oracle.com/technetwork/topics/linuxsoft-082809.html for linux 32bit os.
(look for proper version).
Register and create an oracle account (It’s free and takes couple of minute). Accept license agreement and download.
Extract the files in /usr/lib/ you need to become root for that (use sudo).
3) Set the environment variables.(open bash_profile and set the path variables).
Open [xyz~] $ vi .bash_profile (I set the following path for my Fedora).
export ORACLE_HOME=/appl/paths/instantclient_10_2 <--note client version export LD_LIBRARY_PATH=$ORACLE_HOME/lib export PATH=$ORACLE_HOME/bin:$PATH
4) Install cx_Oracle by double click on cx_Oracle-5.0.4-10g-py25-1.i386.rpm or by running 'python setup.py install'.
5) To check if the installation works properly. $ python >>>import cx_Oracle
4) Install cx_Oracle by double click on cx_Oracle-5.0.4-10g-py25-1.i386.rpm or by running 'python setup.py install'.
5) To check if the installation works properly. $ python >>>import cx_Oracle
>>>
If no error message comes then you are ready to use oracle module.
Simple query to check your connection
#!/usr/bin/python
import cx_Oracle
connstr='scott/tiger'
conn = cx_Oracle.connect(connstr)
curs = conn.cursor()
curs.execute('select * from emp')
print curs.description
for row in curs:
print row
conn.close()
you can bypass TNS by using this as a connection string: scott/tiger@myhost:1521/DATABASE_SID
let me know if anyone is having any trouble configuring cx_Oracle.