Entry
How can I access oracle database using python scripts
Dec 31st, 2002 00:54
maverick b, Smita Agarwal,
The simplest method is the following:
Here i use the cx_Oracle module available from www.computronix.com
#!/usr/bin/python
import os
import sys
import string
dbapi = __import__('cx_Oracle')
import commands
dbh = dbapi.connect(logger_conf.db_dsn)
dbc = dbh.cursor()
dbc.execute("select user_id,user_name,email from users")
rows = dbc.fetchall()
print "\nUSERID:\n",rows[0]
print "\nNAME:\n",rows[1]
print "\nEMAIL:\n",rows[2]
Hope this helps :)