Compiling cx_Oracle for Python from Source on Solaris

We needed to use cx_Oracle on Solaris. cx_Oracle is a Python driver for Oracle. It is mentioned in Oracle FAQ.

In each version, the binaries for Windows and Enterprise Linux are released, but there are no pre-built binary packages for Solaris.

But you can easily download the source package and compile for your system. Its README file mentions that it compiles on Solaris and even they had being informed about successful compilation on Mac OS X.

This post assumes that Oracle was already installed on the system, as in my case.

I have downloaded the "Source Code only" package. For version 5.1, find it here. Download and extract the file, and open a terminal to the directory containing "setup.py".

As its README file says, use the following commands to build (become "root" first):
python setup.py build 
python setup.py install 

After the compilation, you need to do something unrecommended, setting "LD_LIBRARY_PATH", which is labeled as "bad".

Note that using Oracle requires you to use the account "oracle", so we will be using its ".profile" file.

If you "LD_LIBRARY_PATH" is not defined in the profile, you can add the following to the end of the file ".profile".

If you have already defined "LD_LIBRARY_PATH" you can add the following code instead:

If everything went well, you can use it in Python:
import cx_Oracle 
Note that the "oracle" user should be used, not "root".

I have accomplished this using Python 2.4.4 and cx_Oracle 5.1.

To see your Solaris version use the following command:
cat /etc/release 
# Solaris 10 5/09 
# Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved. 
# Use is subject to license terms. 
# Assembled 30 March 2009 

1 comment:

  1. Paylaşımlarınızı beğenerek takip etmekteyim . Dell dizüstü tamir olarak bu güzel paylaşımlarınızın devamını bekleriz .