[Zope-dev] BLOBs with DCOracle and Oracle 8.1.5

Dave Blasby dblasby@refractions.net
Tue, 08 Feb 2000 12:12:54 -0700


I'm trying to deal with Oracle 8.1 BLOBs inside my Zope application. 
Unfortunately, I've had no luck.

I'm using the DCOracle 1.3.0 drivers.  I've installed them, and they
seem to work fine for non-BLOB data.

First, I create a simple table, and add two row:

SQL> create table blob_test ( the_blob  BLOB, the_desc varchar(100) );
SQL> insert into blob_test values ( empty_blob(), 'test1');
SQL> insert into blob_test values ( empty_blob(), 'test2');
SQL> commit;

Then, in python:

% python
Python 1.5.2 (#14, Feb  4 2000, 11:17:38)  [GCC 2.8.1] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import ocidb
>>> import oci_8
>>> cnx = ocidb.Connect("scott/tiger")   

so far, so good.  I can do simple SQL:

>>> cnx.execute("select the_desc from blob_test")
>>> cnx.fetchall()
[('test1',), ('test2',)]

Everything seems to be going well, until I try to manipulate a BLOB:

>>> cnx.execute("select the_blob,the_desc from blob_test")
>>> cnx.fetchone()
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "ociCurs.py", line 294, in fetchone
    self._error()
  File "ociCurs.py", line 81, in _error
    raise error, (rc, oci_.OracleErrorMessage(self._c.lda, rc))
oci.error: (24813, 'ORA-24813: cannot send or receive an unsupported
LOB\012')

OR, at a more simple level, you get the same result:
...
>>> import oci_
>>> cnx.execute("select the_blob,the_desc from blob_test")
>>> oci_.ofetch(cnx._c._c)
-24813

According to the oracle documentation:
-----
ORA-24813 cannot send or receive an unsupported LOB

Cause: An attempt was made to send a LOB across the network, but either
the server does not support the LOB sent by the client, or the client
does not support the LOB sent by the server. This error usually occurs
when the client and server are running different versions of Oracle. 
Action: Use a version of the Oracle that supports the LOB on both the
client and the server. 
----

So, I looked at the oci_8 module:
...
>>> mylob = oci_8.lob(cnx._d)
>>> print mylob
<Lob object at 101d10>

It appears that its created a LOB, but something is wrong:

>>> mylob.length()
-2130640896
>>> mylob.write('adslfjasf')
-2
>>> mylob.length()
-2130640896

Can anyone tell me what I'm doing wrong or point me somewhere?  I've
also tried using the perl DBI/DBD drivers and havent had any luck.

thanks,
dave