Python and Oracle

I would like to be able to connect to Oracle 10.1.0.2.0 (which is installed on another machine) via python.

My computer runs on Ubuntu 9.04 Jaunty with Python 2.6 installed.

I downloaded and unpacked instantclient-basic-linux32-10.1.0.5-20060511.zip, installed LD_LIBRARY_PATHand ORACLE_HOME, to point to the directory in which I unpacked it. Then I downloaded cx_Oracle-5.0.2-10g-py26-1.i386.rpmand installed it:

$sudo alien -i cx_Oracle-5.0.2-10g-py26-1.i386.rpm

When i started

$python -c 'import cx_Oracle'

I get:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/lib/python2.6/cx_Oracle.so: undefined symbol: OCIClientVersion

Help would be greatly appreciated.

+3
source share
2 answers

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

, cx_Oracle , , -DORACLE_10GR2, OCIClientVersion. , - 10g 10gR2 , , , :

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

, , cx_Oracle . (, Python Oracle.)

cx_Oracle Oracle 9i. , , -, .

+4

bobince , , .

LD_LIBRARY_PATH ORACLE_HOME , Oracle InstantClient .

  • cx_Oracle 4.4.1 for Oracle 9i Oracle InstantClient 10.1

cx_Oracle 4.4.1

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

cx_Oracle.so /usr/local/lib/python 2.6/site-packages,

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

, cx_Oracle Oracle 9i, InstantClient

sudo ln -s libclntsh.so.10.1 libclntsh.so.9.0
  • cx_Oracle 5.0.2 for Oracle 10g Oracle InstantClient 10.2

.

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
  • cx_Oracle 10g Oracle InstantClient 10.1 , cx_Oracle 10g , Oracle 10g Release 2.

. , - ( ).

+2
source

Source: https://habr.com/ru/post/1723865/


All Articles