2 Replies Latest reply on Jun 12, 2008 7:19 PM by 615703

    mod_python + cx_Oracle.SessionPool

      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
          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
            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.