[Django]-Python and Oracle

4👍

I believe OCIClientVersion requires Oracle 10g release 2, but you’re using release 1.

It looks like cx_Oracle binary you downloaded has been compiled with -DORACLE_10GR2 which makes it include the OCIClientVersion call. Since this is a compile-time-only option there should really be downloads for 10g and 10gR2 separately, but it would seem there aren’t:

This module has been built with Oracle 9.2.0, 10.2.0, 11.1.0 on Linux

So you may have to download the cx_Oracle sources and build them yourself. (Consequently you’ll need the Python and Oracle client headers.)

Alternatively you could try the cx_Oracle build for Oracle 9i instead. This sounds a bit dodgy but is apparently supposed to work.

2👍

Thanks to bobince for his answer, I will just try to summarize possible solutions to make it more readable for the others.

Both LD_LIBRARY_PATH and ORACLE_HOME need to point to directory where Oracle InstantClient is unpacked.

  • You can use cx_Oracle 4.4.1 for Oracle 9i together with Oracle InstantClient 10.1

After installing cx_Oracle 4.4.1

sudo alien -i cx_Oracle-4.4.1-9i-py26-1.i386.rpm

cx_Oracle.so is placed in /usr/local/lib/python2.6/site-packages, so following symbolic link needs to be created

sudo ln -s /usr/local/lib/python2.6/site-packages/cx_Oracle.so /usr/lib/python2.6

Also since you are using cx_Oracle for Oracle 9i you need to create symbolic link in the InstantClient directory

sudo ln -s libclntsh.so.10.1 libclntsh.so.9.0
  • Alternatively you can use cx_Oracle 5.0.2 for Oracle 10g with Oracle InstantClient 10.2

Installation procedure is similar.

sudo alien -i cx_Oracle-5.0.2-10g-py26-1.i386.rpm
sudo ln -s /usr/lib/python2.6/site-packages/cx_Oracle.so /usr/lib/python2.6
  • Building cx_Oracle 10g sources to work with Oracle InstantClient 10.1 is not an option since cx_Oracle 10g uses code specific to Oracle 10g Release 2.

Note: It is hard to predict whether these solutions work without any flaws (further testing is needed).

👤todoer

Leave a comment