[Zope] Re: [Zope-dev] ZOracle LOB Questions

Matthew T. Kromer matt@digicool.com
Mon, 31 Jul 2000 11:26:03 -0400


Alexander Schad wrote:
> 
> Hello!
> 
> i have Oracle 8.1.6 ZOracleDA 2.2 installed with Zope 2.1.6 on a red hat
> linux machine.
> 
> i have an oracle table with one column containing blobs. Now i have
> the following problems:
> 
> 1. How can i retrieve data from that table in zope or in python (syntax) ?
> 
> 2. How can i insert data to that table ?
>    i need the zope syntax something like:
>         insert into blob_table values ('<dtml-var image>') ???
>    or the python syntax
> 
> i have written a little script:
> 
> import DCOracle, sys, os, DCOracle.dbi
> 
> dbc = DCOracle.Connect('mozdb_dba/mozdb_dba')
> cur = dbc.cursor()
> fn = open('test_img.jpg','rb')
> data = fn.read()
> fn.close()
> param = DCOracle.dbi.dbiRaw(data)
> cur.execute('select blobcol from blobtable')
> dat = cur.fetchone()
> cur.close()
> dbc.close()
> print dat
> 
> when i try to execute it i get the following error:
> 
> Traceback (innermost last):
>   File "blobtest.py", line 12, in ?
>     dat = cur.fetchone()
>   File "DCOracle/ociCurs.py", line 339, in fetchone
>     self._error()
>   File "DCOracle/ociCurs.py", line 109, in _error
>     raise error, (rc, oci_.OracleErrorMessage(self._c.lda, rc))
> oci.error: (24813, 'ORA-24813: cannot send or receive an unsupported
> LOB\012')
> 
> 3. Is there a way to call a stored procedure or function that actually
>    return values ?
>    i succeeded in retrieving one particular value out of a table but when
>    i try a function like :
>         select * from some_table
>    i fail...
> 
> 4. Changes.txt:
> 
>   Z Oracle DA Releases
> 
>   2.2.0
> 
>     Added a small feature that allows you to access LOBs in the Oracle
>     database.  To do this, you must have your maximum number of
>     results set to '1'.  Otherwise, it won't work.
> 
>   i don't know what this is referring to. where should i make this change?
> 
> Ciao,
>         Alex
>

Alex, Oracle 8i broke DCOracle's support for LOBs; DCOracle primarily
uses OCI 7 (Oracle 7) calls, and Oracle 8i enforces a restriction that
OCI 8 objects cannot be used in the context of an OCI 7 statement.

You can use Oracle 8.0 for this, the restriction isn't enforced until
Oracle 8.1.