This discussion is archived
2 Replies Latest reply: Jun 12, 2008 12:19 PM by 615703 RSS

mod_python + cx_Oracle.SessionPool

615703 Newbie
Currently Being Moderated
Greetings all,

I am working with mod_python, using Python Server Pages, and I am researching the use of connection pooling from cx_Oracle for this web app.
Does anyone have experience with this that could shed some light on where I should start?
I am relatively new to Python and I haven't found any revelations from my perusing of the mod_python documentation
(although it might be there and I am just not getting it). I appreciate any advice you can provide.

Oracle 10g Release 2

  • 1. Re: mod_python + cx_Oracle.SessionPool
    cj Employee ACE
    Currently Being Moderated
    Cx_Oracle has session pooling:
    import cx_Oracle

    pool = cx_Oracle.SessionPool(user='hr',password='hrpwd',dsn='localhost/orcl',min=1,max=2,increment=1)
    db = pool.acquire()

    cursor = db.cursor()
    cursor.arraysize = 50
            select city
            from locations""")
    for city in cursor.fetchall():
        print "Values:", city

    If you link Python with Oracle 11g libraries and connect to an Oracle 11g database you can also use "Database Resident Connection Pooling (DRCP)" by adding "pooled" to the connection string:
    pool = cx_Oracle.SessionPool(user='hr',password='hrpwd',dsn='localhost/orcl:pooled',min=1,max=2,increment=1)
  • 2. Re: mod_python + cx_Oracle.SessionPool
    615703 Newbie
    Currently Being Moderated
    Thanks for the reply.

    I am aware of the SessionPool functionality provided via cx_Oracle but what I was looking for was some guidance on how to implement with mod_python and Apache.
    Specifically, can I keep the connection pool around between requests that are sent to the web server?
    Appreciate any input.