472,117 Members | 2,743 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,117 software developers and data experts.

installing cx_Oracle.

I am trying to use this:
http://python.net/crew/atuining/cx_O...cx_Oracle.html
it is a real module, right?

sudo easy_install cx_Oracle did not easy_install cx_Oracle.

http://www.python.org/pypi/cx_Oracle/4.3.1 doesn't give me any clue.

I got the source from
http://prdownloads.sourceforge.net/c...ar.gz?download

carl@dell17:~/a/cx_Oracle-4.3.1$ python setup.py build
Traceback (most recent call last):
File "setup.py", line 36, in ?
oracleHome = os.environ["ORACLE_HOME"]
File "/usr/lib/python2.4/UserDict.py", line 17, in __getitem__
def __getitem__(self, key): return self.data[key]
KeyError: 'ORACLE_HOME'
Now I don't really know whos problem this is.

Carl K
May 24 '07 #1
7 14582
Carl K schrieb:
I am trying to use this:
http://python.net/crew/atuining/cx_O...cx_Oracle.html
it is a real module, right?

sudo easy_install cx_Oracle did not easy_install cx_Oracle.

http://www.python.org/pypi/cx_Oracle/4.3.1 doesn't give me any clue.

I got the source from
http://prdownloads.sourceforge.net/c...ar.gz?download
carl@dell17:~/a/cx_Oracle-4.3.1$ python setup.py build
Traceback (most recent call last):
File "setup.py", line 36, in ?
oracleHome = os.environ["ORACLE_HOME"]
File "/usr/lib/python2.4/UserDict.py", line 17, in __getitem__
def __getitem__(self, key): return self.data[key]
KeyError: 'ORACLE_HOME'
yours. because you need the oracle OCI with libs and header files
installed + the environment variable ORACLE_HOME pointing to the
installation.

I suggest you download the appropriat oracle instant client for your system.

Diez
May 24 '07 #2
Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
$ python setup.py build
$ sudo python setup.py install

$ python -c "import cx_Oracle"
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or
directory

guessing I need to add
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/
to some path?

btw - anyone know of a .deb that will install this?

Carl K
May 24 '07 #3
Carl K wrote:
Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
$ python setup.py build
$ sudo python setup.py install

$ python -c "import cx_Oracle"
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or
directory

guessing I need to add
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/
to some path?
You can `export
LD_LIBRARY_PATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib`

or (assuming a recent RedHat linux (or similar) now), put that path in a
file, /etc/ld.so.conf.d/oracle.conf

and run /sbin/ldconfig

You'll find the latter operation to be persistent, and the former is not.
btw - anyone know of a .deb that will install this?

Carl K
May 24 '07 #4
Bill Scherer wrote:
Carl K wrote:
>Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
$ python setup.py build
$ sudo python setup.py install

$ python -c "import cx_Oracle"
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: libclntsh.so.10.1: cannot open shared object file: No
such file or directory

guessing I need to add
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/
to some path?
You can `export
LD_LIBRARY_PATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib`

or (assuming a recent RedHat linux (or similar) now), put that path in a
file, /etc/ld.so.conf.d/oracle.conf

and run /sbin/ldconfig

You'll find the latter operation to be persistent, and the former is not.
>btw - anyone know of a .deb that will install this?

Carl K
bingo.

carl@dell17:~/a/cx_Oracle-4.3.1$ python
Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import cx_Oracle
connection = cx_Oracle.connect('testuserA', 'pw', 'nf55')
cursor = connection.cursor()
cursor.execute("select * from tbl1")
[<cx_Oracle.NUMBER with value None>, <cx_Oracle.FIXED_CHAR with value None>,
<cx_Oracle.NUMBER with value None>]
>>rows=cursor.fetchall()
rows
[(1, 'a ', 1.01), (2, 'a ', 1.02), (3, 'a ', 1.03)]

Thanks - now I can get to the real problem: client side join/order by :)

But I have already done it in MySql, so this should be the easy part...

Thanks again.

Carl K
May 24 '07 #5
Dennis Lee Bieber wrote:
On Thu, 24 May 2007 09:07:07 -0500, Carl K <ca**@personnelware.com>
declaimed the following in comp.lang.python:
>Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client

Don't those lines need to be reversed? Set the variable in the
current shell, and /then/ export it?
Modern shells actually allow the single statement

export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
------------------ Asciimercial ---------------------
Get on the web: Blog, lens and tag your way to fame!!
holdenweb.blogspot.com squidoo.com/pythonology
tagged items: del.icio.us/steve.holden/python
All these services currently offer free registration!
-------------- Thank You for Reading ----------------

May 24 '07 #6
Dennis Lee Bieber wrote:
On Thu, 24 May 2007 09:07:07 -0500, Carl K <ca**@personnelware.com>
declaimed the following in comp.lang.python:
>Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client

Don't those lines need to be reversed? Set the variable in the
current shell, and /then/ export it?
whoops - I may have cut/pasted too fast.

Carl K
May 24 '07 #7
On Thu, 2007-05-24 at 16:15 +0000, Dennis Lee Bieber wrote:
On Thu, 24 May 2007 09:07:07 -0500, Carl K <ca**@personnelware.com>
declaimed the following in comp.lang.python:
Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client

Don't those lines need to be reversed? Set the variable in the
current shell, and /then/ export it?
It also works the other way around, at least on the non-empty set of
systems that contains my workstation. export simply marks the variable
name for automatic export to the environment of subsequent commands. The
value at that time doesn't matter. What matters is the value that the
name has at the time the command is run:

[carsten@dot ~]$ export FOOD
[carsten@dot ~]$ FOOD=spam
[carsten@dot ~]$ python -c "import os; print os.environ['FOOD']"
spam
[carsten@dot ~]$ FOOD=eggs
[carsten@dot ~]$ python -c "import os; print os.environ['FOOD']"
eggs

Regards,

--
Carsten Haese
http://informixdb.sourceforge.net
May 24 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by GrayGeek | last post: by
8 posts views Thread by Rodrigo Daunaravicius | last post: by
1 post views Thread by Greg Lindstrom | last post: by
1 post views Thread by jmdeschamps | last post: by
reply views Thread by Steve | last post: by
4 posts views Thread by infidel | last post: by
1 post views Thread by Lukas Ziegler | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.