Oracle support

29 views
Skip to first unread message

kromakey

unread,
Dec 21, 2006, 5:27:24 AM12/21/06
to web.py
Hi,

I've recently started using web.py and needed to connect to Oracle, as
it isn't currently supported I've added some basic support to my
install to allow this and it seems to work quite well, please correct
me if I'm missing something obvious. The patch requires cx_Oracle and
doesn't support pooling, the additions to db.py are:

lines: 263,272

elif dbn == "oracle":
import cx_Oracle as db
if 'pw' in keywords:
keywords['password'] = keywords['pw']
del keywords['pw']
web.config._hasPooling = False
keywords['database'] = keywords['db']
del keywords['db']
db.paramstyle = 'numeric'

lines: 311,314

if not web.ctx.db_name == 'oracle':
web.ctx.db = db.connect(**keywords)
if web.ctx.db_name == 'oracle':
web.ctx.db = db.connect(keywords.get('user'),
keywords.get('password'), keywords.get('database'))

lines: 563,565

elif web.ctx.db_name == "oracle":
web.ctx.db_execute(db_cursor, sql_query)
sql_query = SQLQuery("SELECT "+seqname+".currval from dual")

Cheers
kromakey

Reply all
Reply to author
Forward
0 new messages