Mailing List Archive

Reading Oracle BLOBS from Zope
I want to read an Oracle BLOB and display it. I have seen several
examples on the internet, but none of them seem to work.

I am on the following platform:

Zope Version (Zope 2.6.1 (source release, python 2.1, linux2), python
2.1.3, linux2) Python Version 2.1.3 (#1, Sep 19 2002, 21:42:04) [GCC
2.96 20000731 (Red Hat Linux 7.3 2.96-110)] System Platform linux2

I am trying to read a BLOB from an Oracle database. I have noticed
that when I test the ZSQL, I get the following error:



The SQL:

select wgtphot_photo as photo from kenglund.wgtphot where wgtphot_pidm
= 252853

This seems to be returning the image ok. I had to set the max results
to one to get it to work.

The Python:

result = []
lob = ['image']
for row in context.sqllogo:
lob = row['photo']
# result.append({'image': lob.read()})
# above was remmed
container.REQUEST.RESPONSE.setHeader('content-type', 'image/jpeg') return lob

The Web page:

<td><img src="logo;" alt="foto"></td>

Can you give me some ideas as to what I am doing wrong, or if it is
even possible to do what I am trying? I know we are on an old version
of Zope and Python. I inherited this system from someone no longer
working here, and upgrading is on my to-do list.

Thanks so very much!

Ken Englund
Sweet Briar College
Sweet Briar, Virginia
United States


_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db
Re: Reading Oracle BLOBS from Zope [ In reply to ]
--On 7. September 2007 15:08:48 -0400 "Kenneth A. Englund"
<kenglund@sbc.edu> wrote:

> I want to read an Oracle BLOB and display it. I have seen several
> examples on the internet, but none of them seem to work.
>
> I am on the following platform:
>
> Zope Version (Zope 2.6.1 (source release, python 2.1, linux2), python
> 2.1.3, linux2) Python Version 2.1.3 (#1, Sep 19 2002, 21:42:04) [GCC
> 2.96 20000731 (Red Hat Linux 7.3 2.96-110)] System Platform linux2
>

Zope 2.6.1 is *old*. You might look at the various SQLAlchemy wrappers
available for Python which should support Oracle BLOBs.

-aj
Re: Reading Oracle BLOBS from Zope [ In reply to ]
Am 07.09.2007, 21:08 Uhr, schrieb Kenneth A. Englund <kenglund@sbc.edu>:

> I am trying to read a BLOB from an Oracle database. I have noticed that
> when I test the ZSQL, I get the following error:

The error seems to be missing from your post. The code itself looks
reasonable.

Charlie

--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::

eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db