»
S
I
D
E
B
A
R
«
Connecting to Oracle from Python
Nov 27th, 2009 by admin

cx_Oracle is a Python extension module that allows access to Oracle databases and conforms to the Python database API specification.

More information is available here. Here is a sample showing how to connect and process a query.

#!/usr/bin/python

import cx_Oracle
connstr='scott/tiger'
conn = cx_Oracle.connect(connstr)
curs = conn.cursor()

curs.execute('select * from emp')
print curs.description
for row in curs:
    print row
conn.close()