hi
i am ibrahim HIDIR from Turkey, Ankara
1. I need a connection pooling for any db, so i tried to use DBPool
utilyty, but i got hundreds of connection in my oracle db, i think i
did something wrong, the code i used is,
file : con_ora.py
import cx_Oracle
from MiscUtils.DBPool import DBPool
class conect(DBPool):
=09
=09def __init__(self):
=09=09self.conn =3D None
=09=09self.cur =3D None
=09
=09def try_connect(self,guser=3D'B2MSYS',gpasswd=3D'B2MSYS',gdb=3D'DUNYA_SR=
V'):
=09=09dbPool =3D DBPool(cx_Oracle, 5, user=3Dguser, password=3Dgpasswd, dsn=
=3Dgdb)
=09=09self.conn =3D dbPool.getConnection()
=09=09self.cur =3D self.conn.cursor()
=09
=09def run(self,sqls=3D''):
=09=09self.cur.execute(sqls)
=09=09don =3D self.cur.fetchall()
=09=09
=09=09return don
=09
=09def run_dml(self):
=09=09self.cur.execute(sqls)
=09
=09def commit(self):
=09=09self.conn.commit()
=09=09
=09def cls_conn(self):
=09=09self.conn.close()
2. but i want to open connections during appserver load, is this
possible to open connections with pool and used it in py or psp
files?
|