[Zope] dcoracle

Oleg Broytmann phd@phd.russ.ru
Wed, 29 Dec 1999 15:33:41 +0000 (GMT)


On Wed, 29 Dec 1999, Adam Gotheridge wrote:
> I can't find a single example how to use the dcoracle package and can't
> figure it out. The documentation says:
> Connect(connection_string)
> Constructor for creating a connection to the database. Returns a Connection
> Object.

   Tested 2 days ago:

import os
os.environ["ORACLE_HOME"] = "/usr/local/oracle/app/oracle/product/8.0.5"
os.environ["NLS_LANG"] = "AMERICAN_AMERICA.CL8KOI8R"

from DCOracle import Connect
jwt = Connect("user/passwd@SID")

cursor = jwt.cursor()
format = "%s | "*13 + "%s\n"

cursor.execute("SELECT * FROM sides_view")
while 1:
   olist = cursor.fetchmany(10)
   if not olist: break
   for row in olist:
      sys.stdout.write(format % row)

cursor.close()
jwt.close()

Oleg.
---- 
    Oleg Broytmann      Foundation for Effective Policies      phd@phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.