Download and install all instant client rpm
s from the Oracle website. For version 11.2.0.4.0
you probably need at least
oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
Install them by using
sudo apt-get install alien dpkg-dev debhelper build-essential
sudo alien -k --scripts <the package>.rpm
sudo dpkg -i <the package>.deb
Follow every single instruction on https://help.ubuntu.com/community/Oracle%20Instant%20Client to set the environment and libraries up.
The sqlplus
client should now work
sqlplus64 --help
Now you can install cx_Oracle
pip install cx_Oracle
With sqpplus
sqlplus64 'scott@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=ORCL)))'
With sqlalchemy
engine = create_engine("oracle+cx_oracle://scott:tiger@localhost:1521/ORCL")
engine.execute("SELECT username FROM all_users ORDER BY username").fetchall()