Oracle database 11g and Python cx_Oracle site-packages

Since Python and Jython  is a powerfull way to help Oracle Fusion Middleware developers, the need for database access grows. Therefore i write this installation plan to connect your Pyhton code to a Oracle 11g database using:

Instant Client Package – Basic
Instant Client Package – SQL*Plus
Instant Client Package – SDK

Follow the steps below:

  1. Download the software listed above.
  2. Extract all downloaded zips of the Oracle Instant Client to a dir which is called the ORACLE_HOME
    I used /apps/oracle/instantclient_11_2
  3. Extract the cx_Oracle dir to a tempory location, i used /apps/oracle/cx_Oracle-5.1.1
  4. Add following exports to your global Linux profile:
    export ORACLE_HOME
    export LD_LIBRARY_PATH
    export PATH
  5. Go to /apps/oracle/instantclient_11_2 and generate some soft links.
    ln -s
    ln -s
    ln -s
    ln -s
  6. Go to the extracted cx_Oracle directory and run:
    python build
    python install
  7. Now start a Python shell and try:
Python 2.7.2 (default, Mar 20 2012, 03:06:10)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle

 If You get “missing library .so” errors:

  • Check your .bash_profile for the correct $PATH, $LD_LIBRARY_PATH and $ORACLE_HOME exports.
  • Check the permissions from the instantclient dir (/apps/oracle/instantclient_11_2)

That’s all it is to. Good luck with using your database!

Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: