I have installed oracle client and oracle client-dev, and setup ORACLE_HOME environment variable. Yet when I attempt to install tux_oracle (python setup.py build) I get the following: fatal error: oci.h: No such file or directory
Well, the answer is to install cx_Oracle not tx_Oracle. The way to do it in Ubuntu is the following:
sudo apt-get -i alien
sudo alien -d oracle-instantclient11.2-sqlplus-11.2.0.2.0.i386.rpm
sudo dpkg -i oracle-instantclient11.2-basic_11.2.0.2.0-2_i386.deb
export ORACLE_HOME=/usr/lib/oracle/11.2/client source oracle.sh
sudo vi /etc/ld.so.conf.d/oracle.conf which must contain: "$ORACLE_HOME/lib" sudo ldconfig
sudo alien -d cx_Oracle-5.1-11g-py32-1.i386.rpm sudo dpkg -i cx-oracle_5.1-2_i386.deb
Now you should have no problem connecting to oracle. From python type:
import cx_Oracle
To connect to the database specify a connection string in tsnames.ora or directly:
connection_string = 'username/password@(DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA= (SID=MY_SID)))'
I am using cx_oracle to connect to my Oracle database. Did you give it a try?
That header file can be found in the development suite. For some reason, it's not included in the default distribution package. Have a look at
http://my.opera.com/onyxluo/blog/cannot-find-oci-h-in-oracle9-2-client
Here's the page content, for your convenience. I got it from Google cache as the page was down when I got there.
The reason of this problem is because OCI (Oracle Call Interface)package is not installed in Oracle9.2 client. The default path of "oci.h" is $ORACLE_HOME/rdbms/demo. This problem doesn't exist on Oracle Database 9.2.0.1. But for Oracle 9.2.0.1 client, OCI package is not included in client even if you select the full package of client installation.
Solution:
- install Oracle 9.2.0.1 client first.
- In OUI(Oracle Universal Installer), use the same oracle home with Oracle 9.2.0.1 client, and then select Oracle Database install.
- Choose Customized in database installation
- Uncheck Enterprise Manager and Oracle Database and others except OCI and OCCI.
After OCI installed, $ORACLE_HOME/rdbms/demo will contain oci.h and other *.h files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With