How to install cx_Oracle and Oracle SQL Developer

How to install cx_Oracle and Oracle SQL Developer


This tutorial shows you how to install cx_Oracle, the Oracle database connector for Python. This tutorial is based on 32-bit Ubuntu Linux with Python 2.7. There are 64-bit rpms available from Oracle.

First, download the dependencies.

sudo apt-get install python-dev python-setuptools libc6-dev libaio1 alien

Now, download the Oracle Instantclient rpms from Oracle here: http://www.oracle.com/technetwork/topics/linuxsoft-082809.html. You will need to create a free account and register with Oracle before downloading. Download the following packages:

Instant Client Package - Basic

Instant Client Package - SDK

Instant Client Package - SQL*Plus

Now install,

sudo alien oracle-instantclient*.rpm

Install the .deb's,

sudo dpkg -i oracle*.deb

Configure libraries & run ldconfig

sudo bash

echo "/lib" > /etc/ld.so.conf.d/oracle-instantclient11.2-basic.conf

echo "/usr/lib/oracle/{version}/client/lib" >> /etc/ld.so.conf.d/oracle-instantclient11.2-basic.conf ( use 'client64' for 64-bit rpms )

ldconfig

exit

Setup Environment Variables,

echo "export ORACLE_HOME=/usr/lib/oracle/11.2/client[64]/" >> ~/.bashrc

echo "export LD_LIBRARY_PATH=$ORACLE_HOME/lib:" >> ~/.bashrc

echo "export PATH=$ORACLE_HOME/bin:$PATH" >> ~/.bashrc

User easy_install to install the Python Oracle connector,

sudo -E easy_install cx_Oracle

Now test that the installation completed successfully,

Python 2.7.2+ (default, Oct 4 2011, 20:03:08)

[GCC 4.6.1] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import cx_Oracle

>>>

If you are having issues, make sure your .bashrc file looks similar to this:

export ORACLE_HOME=/usr/lib/oracle/11.2/client/

export LD_LIBRARY_PATH=/lib:/usr/lib/oracle/11.2/client/lib/

You ought to download the Oracle DQL Developer tool to analyze tables and SQL statements while you code.

Download the correct Oracle package for your platform here ( once again you'll need a login with Oracle ):

http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html

Create the deb:

sudo alien sqldeveloper-3.1.07.42-1.noarch.rpm

Install the deb:

sudo dpkg -i sqldeveloper_3.1.07.42-2_all.deb

Make sure you have the Sun Java installed:

sudo aptitude purge openjdk-6-jdk openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib

sudo aptitude install sun-java6-jdk sun-java6-jre sun-java6-plugin sun-java6-bin

Initially it will ask for java, pass it the path to your installation:

/usr/local/bin/sqldeveloper

/usr/lib/jvm/java-6-openjdk/

You now need to setup the connectino configurations when sqldeveloper first opens. Also, create a custom launcher to quickly access sqldeveloper.

Hope this helps someone, Happy Codi



ClassyBits 2016