File: class/Extras/Code/Dbase/dbapi.py

########################################
# example of portable database API usage
########################################

from dcoracle import Connect
connobj = Connect("user/password@system")
cursobj = connobj.cursor()

value1,value2 ='developer', 40
query = 'SELECT name, shoesize FROM empl WHERE job = ? AND age = ?'

cursobj.execute(query, (value1, value2))
results = cursobj.fetchall()
for (name, size) in results:
    print name, size



[Home page] Books Code Blog Python Author Train Find ©M.Lutz