accessing Oracle DB using Python, in Debian


The following instructions assume that you are using Debian Squeeze, the current 'stable' release. The instructions here are very specific, so look elsewhere for something more generic.


installation and setup:

sudo apt-get install libpython3.1 libaio1 alien
sudo alien --install oracle-instantclient11.2-basic*rpm cx_Oracle*rpm
sudo ln -s /usr/lib/python3.1/site-packages/ /usr/lib/python3.1/lib-dynload
sudo ln -s /usr/lib/oracle/11.2/client/lib/ /usr/lib
sudo ln -s /usr/lib/oracle/11.2/client/lib/ /usr/lib
echo export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib >> ~/.bashrc
source ~/.bashrc
python3 -c 'import cx_Oracle'

If that last line executes without printing a message to the screen, the install is most likely successful.

For basic usage, see this tiny tutorial.