Accessing Oracle from Python remotely ?

gkiffney gkiffney at my-deja.com
Wed Mar 21 10:18:52 EST 2001


There's http://www.zope.org/Products/DCOracle which should get you started.
There was an article by Uche Ogbuji in Linuxworld that helped me get going
with this, but it's apparently fallen off the Internet map into the bit
bucket.  Using the dcoracle module (which is a bit of a pain to get going,
look at the Zope docs carefully, and if you can find the prebuilt dll's, use
those), you can do things like this:

[uche at malatesta uche]$ python
Python 1.5.1 (#1, Sep 3 1998, 22:51:17) [GCC 2.7.2.3] on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import DCOracle
>>> #connect to DB. scott/tiger are the test database username/password
>>> dbc=DCOracle.Connect("scott/tiger at sforza") #sforza is the local Oracle
server
>>> c = dbc.cursor()
>>> c.execute("SELECT * FROM emp WHERE emp.deptno = 10")
>>> rows = c.fetchall()
>>> print rows
[(7782, 'CLARK', 'MANAGER', 7839, dbiDate('1981-06-09 00:00:00'), 2450.0,
None, 10),
(7839, 'KING', 'PRESIDENT', None, dbiDate('1981-11-17 00:00:00'), 5000.0,
None, 10),
(7934, 'MILLER', 'CLERK', 7782, dbiDate('1982-01-23 00:00:00'), 1300.0,
None, 10)]



"Fred Pacquier" <fredp at mygale.org.nospam> wrote in message
news:Xns906AB9C901807PaCmAnRDLM at 161.48.76.20...
> Hi,
>
> I have an Oracle (7) database running on a Windows NT 4 server. Is it
> possible (easy, difficult ?) to read the data in those tables from a
python
> script running on a remote Unix (Solaris) box ?
>
> Sorry if the question is silly -- I do know a bit of python but I'm
> inexperienced in databases and their connectivity. Any pointers welcome
> though.
>
> Thanks,
> fp
>
> --
> YAFAP : http://www.multimania.com/fredp/





More information about the Python-list mailing list