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. This looks fine and returns a connection object with dbc = oci_.Connect('scott/tiger@thunder') The docs describing connection object includes: cursor() Return a new Cursor Object. An exception may be thrown if the database does not support a cursor concept. I can't get this to work and don't know why. Code looks like: #!/usr/bin/python import sys sys.path.append('/usr/local/zope/Zope-2.0.1-linux2-x86/lib/python/Products/Z OracleDA/DCOracle') import Buffer, oci_ dbc = oci_.Connect('scott/tiger@thunder') cursor = dbc.cursor() error returned is: AttributeError: 'Connection' object has no attribute 'cursor' Can anyone post a simple example of how to connect and return a recordset? Thanks
On 12/29/99 10:02 AM, Adam Gotheridge at adam@foxvalley.net wrote:
I can't find a single example how to use the dcoracle package and can't figure it out. The documentation says:\
First, this isn't an appropriate place to discuss the DC Oracle package, but I'll address it quickly. The DCOracle package conforms to the Python DB-API 1.0 standard, and behaves like any other adapter at that point. You should look at the reference at: http://www.python.org/topics/database/DatabaseAPI-1.0.html You should NOT be using the oci_ module, that's a VERY low level attachment to the OCI interface. Chris -- | Christopher Petrilli Python Powered Digital Creations, Inc. | petrilli@digicool.com http://www.digicool.com
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.
participants (3)
-
Adam Gotheridge -
Christopher Petrilli -
Oleg Broytmann