Reading Data From ORACLE via Python

Elena Günzler guenzler at gsi-berlin.de
Thu Aug 17 05:35:16 EDT 2000


Hello!

I'm trying to get some data from ORACLE via ORACLE Objects for OLE 2.3.

first method:
>>> import win32com.client
>>> xSess = win32com.client.Dispatch("OracleInProcServer.XOraSession")
>>> xSess
<COMObject OracleInProcServer.XOraSession>
>>> xSess.Name
'2'
>>> xDb = xSess.OpenDatabase("alias", "user/pwd", 0)
Traceback (innermost last):
File "<interactive input>", line 1, in ?
TypeError: call of non-function (type None)
>>>
Why does a call to a property work, but a call of a function (marked as
property) doesn't?

second method:
>>> import win32com.client.gencache
>>> xMod =
win32com.client.gencache.EnsureModule('{F2D4ED20-FFD3-101A-ADF2-04021C007002
}', 0, 2, 3)
>>> xSess = xMod._OraSessionClass()
>>> xSess
<win32com.gen_py.Oracle InProc Server 2.3 Type Library._OraSessionClass>
>>> xDb = xSess.OpenDatabase("alias", "user/pwd", 0)
>>> xDb.RDBMSVersion
'Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production\012With the
Partitioning option\012JServer Release 8.1.6.0.0 - Production'
>>> xDb.Session
<win32com.gen_py.Oracle InProc Server 2.3 Type Library._IOraSession>
>>> xDb.Connect
'user'
>>> xDb.DatabaseName
'alias'
>>> xRds = xDb.CreateDynaset("select * from xyz", 0)
Traceback (innermost last):
  File "<interactive input>", line 1, in ?
TypeError: call of non-function (type None)
>>>
Here the call to OpenDatabase was successfull (at least no TypeError was
made). But from the result I again can get only properties. Any function
call leads to a TypeError message.

Is there anybody who knows how that will work? Is there any other way to get
data from ORACLE?

Thanks in advance
Elena








More information about the Python-list mailing list